hawatel_search_jobs 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/reed_spec.rb CHANGED
@@ -1,81 +1,78 @@
1
- require 'spec_helper'
2
- require 'ostruct'
3
-
4
- describe HawatelSearchJobs::Api::Reed do
5
- context 'APIs returned jobs' do
6
- before(:each) do
7
- HawatelSearchJobs.configure do |config|
8
- config.reed[:api] = "reed.co.uk/api"
9
- config.reed[:clientid] = ''
10
- end
11
-
12
- @query_api = { :keywords => 'ruby', :location => 'London' }
13
-
14
- @result = HawatelSearchJobs::Api::Reed.search(
15
- :settings => HawatelSearchJobs.reed,
16
- :query => {
17
- :keywords => @query_api[:keywords],
18
- :location => @query_api[:location]
19
- })
20
- end
21
-
22
- xit '#search' do
23
- validate_result(@result, @query_api)
24
- expect(@result.page).to be >= 0
25
- expect(@result.last).to be >= 0
26
- end
27
-
28
- xit '#page' do
29
- validate_result(@result, @query_api)
30
- page_result = HawatelSearchJobs::Api::Reed.page({:settings => HawatelSearchJobs.reed, :query_key => @result.key, :page => 1})
31
- expect(page_result.key).to match(/&resultsToSkip=25/)
32
- expect(page_result.page).to eq(1)
33
- expect(page_result.last).to be >= 0
34
- end
35
- end
36
-
37
- context 'APIs returned empty table' do
38
- before(:each) do
39
- HawatelSearchJobs.configure do |config|
40
- config.reed[:api] = "reed.co.uk/api"
41
- config.reed[:clientid] = ''
42
- end
43
-
44
- @query_api = { :keywords => 'job-not-found-zero-records', :location => 'London' }
45
-
46
- @result = HawatelSearchJobs::Api::Reed.search(
47
- :settings => HawatelSearchJobs.reed,
48
- :query => {
49
- :keywords => @query_api[:keywords],
50
- :location => @query_api[:location]
51
- })
52
- end
53
-
54
- xit '#search' do
55
- validate_result(@result, @query_api)
56
- expect(@result.totalResults).to eq(0)
57
- expect(@result.page).to be_nil
58
- expect(@result.last).to be_nil
59
- end
60
-
61
- xit '#page' do
62
- validate_result(@result, @query_api)
63
- page_result = HawatelSearchJobs::Api::Reed.page({:settings => HawatelSearchJobs.reed, :query_key => @result.key, :page => 1})
64
- expect(page_result.key).to match(/&resultsToSkip=25/)
65
- expect(@result.totalResults).to eq(0)
66
- expect(@result.page).to be_nil
67
- expect(@result.last).to be_nil
68
- end
69
-
70
- end
71
-
72
- private
73
-
74
- def validate_result(result, query_api)
75
- expect(result.code).to eq(200)
76
- expect(result.msg).to eq('OK')
77
- expect(result.totalResults).to be >= 0
78
- expect(result.key).to match("locationName=#{query_api[:location]}")
79
- expect(result.key).to match("keywords=#{query_api[:keywords]}")
80
- end
1
+ require 'spec_helper'
2
+ require 'ostruct'
3
+
4
+ xdescribe HawatelSearchJobs::Api::Reed do
5
+ before(:each) do
6
+ HawatelSearchJobs.configure do |config|
7
+ config.reed[:api] = "reed.co.uk/api"
8
+ config.reed[:clientid] = ''
9
+ end
10
+ end
11
+
12
+ context 'APIs returned jobs' do
13
+ before(:each) do
14
+ @query_api = { :keywords => 'ruby', :location => 'London' }
15
+
16
+ @result = HawatelSearchJobs::Api::Reed.search(
17
+ :settings => HawatelSearchJobs.reed,
18
+ :query => {
19
+ :keywords => @query_api[:keywords],
20
+ :location => @query_api[:location]
21
+ })
22
+ end
23
+
24
+ it '#search' do
25
+ validate_result(@result, @query_api)
26
+ expect(@result.page).to be >= 0
27
+ expect(@result.last).to be >= 0
28
+ end
29
+
30
+ it '#page' do
31
+ validate_result(@result, @query_api)
32
+ page_result = HawatelSearchJobs::Api::Reed.page({:settings => HawatelSearchJobs.reed, :query_key => @result.key, :page => 1})
33
+ expect(page_result.key).to match(/&resultsToSkip=25/)
34
+ expect(page_result.page).to eq(1)
35
+ expect(page_result.last).to be >= 0
36
+ end
37
+ end
38
+
39
+ context 'APIs returned empty table' do
40
+ before(:each) do
41
+ @query_api = { :keywords => 'job-not-found-zero-records', :location => 'London' }
42
+
43
+ @result = HawatelSearchJobs::Api::Reed.search(
44
+ :settings => HawatelSearchJobs.reed,
45
+ :query => {
46
+ :keywords => @query_api[:keywords],
47
+ :location => @query_api[:location]
48
+ })
49
+ end
50
+
51
+ it '#search' do
52
+ validate_result(@result, @query_api)
53
+ expect(@result.totalResults).to eq(0)
54
+ expect(@result.page).to be_nil
55
+ expect(@result.last).to be_nil
56
+ end
57
+
58
+ it '#page' do
59
+ validate_result(@result, @query_api)
60
+ page_result = HawatelSearchJobs::Api::Reed.page({:settings => HawatelSearchJobs.reed, :query_key => @result.key, :page => 1})
61
+ expect(page_result.key).to match(/&resultsToSkip=25/)
62
+ expect(@result.totalResults).to eq(0)
63
+ expect(@result.page).to be_nil
64
+ expect(@result.last).to be_nil
65
+ end
66
+
67
+ end
68
+
69
+ private
70
+
71
+ def validate_result(result, query_api)
72
+ expect(result.code).to eq(200)
73
+ expect(result.msg).to eq('OK')
74
+ expect(result.totalResults).to be >= 0
75
+ expect(result.key).to match("locationName=#{query_api[:location]}")
76
+ expect(result.key).to match("keywords=#{query_api[:keywords]}")
77
+ end
81
78
  end
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,2 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'hawatel_search_jobs'
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'hawatel_search_jobs'
data/spec/xing_spec.rb CHANGED
@@ -1,48 +1,47 @@
1
- require 'spec_helper'
2
- require 'xing_api'
3
-
4
- describe "HawatelSearchJobs::Api::Xing" do
5
-
6
- before(:each) do
7
- HawatelSearchJobs.configure do |config|
8
- config.xing[:consumer_key] = ''
9
- config.xing[:consumer_secret] = ''
10
- config.xing[:oauth_token] = ''
11
- config.xing[:oauth_token_secret] = ''
12
- end
13
- end
14
-
15
- let(:client) { return HawatelSearchJobs::Client.new }
16
- let(:result) {
17
- return HawatelSearchJobs::Api::Xing.search(
18
- :settings => HawatelSearchJobs.xing,
19
- :query => { :keywords => 'ruby', :company => '' }
20
- )}
21
-
22
- xit "metadata from search() result" do
23
- expect(result.page).to be_a_kind_of(Integer)
24
- expect(result.last).to be_a_kind_of(Integer)
25
- expect(result.totalResults).to be_a_kind_of(Integer)
26
- end
27
-
28
- xit "job attributes from search() result" do
29
- result.jobs.each do |job|
30
- expect(job.jobtitle).to be_a_kind_of(String)
31
- expect(job.location).to be_a_kind_of(String)
32
- expect(job.company).to be_a_kind_of(String)
33
- expect(job.url).to include('http')
34
- end
35
- end
36
-
37
- xit "call page() without specified page (default 0)" do
38
- jobs = HawatelSearchJobs::Api::Xing.page({:query_key => result.key})
39
- expect(jobs.page).to eq(0)
40
- end
41
-
42
- xit "call page() with specified page" do
43
- jobs = HawatelSearchJobs::Api::Xing.page({:query_key => result.key, :page => 1})
44
- expect(jobs.page).to eq(1)
45
- end
46
-
47
-
1
+ require 'spec_helper'
2
+ require 'xing_api'
3
+
4
+ xdescribe "HawatelSearchJobs::Api::Xing" do
5
+
6
+ before(:each) do
7
+ HawatelSearchJobs.configure do |config|
8
+ config.xing[:consumer_key] = ''
9
+ config.xing[:consumer_secret] = ''
10
+ config.xing[:oauth_token] = ''
11
+ config.xing[:oauth_token_secret] = ''
12
+ end
13
+ end
14
+
15
+ let(:client) { return HawatelSearchJobs::Client.new }
16
+ let(:result) {
17
+ return HawatelSearchJobs::Api::Xing.search(
18
+ :settings => HawatelSearchJobs.xing,
19
+ :query => { :keywords => 'ruby', :company => '' }
20
+ )}
21
+
22
+ it "metadata from search() result" do
23
+ expect(result.page).to be_a_kind_of(Integer)
24
+ expect(result.last).to be_a_kind_of(Integer)
25
+ expect(result.totalResults).to be_a_kind_of(Integer)
26
+ end
27
+
28
+ it "job attributes from search() result" do
29
+ result.jobs.each do |job|
30
+ expect(job.jobtitle).to be_a_kind_of(String)
31
+ expect(job.location).to be_a_kind_of(String)
32
+ expect(job.company).to be_a_kind_of(String)
33
+ expect(job.url).to include('http')
34
+ end
35
+ end
36
+
37
+ it "call page() without specified page (default 0)" do
38
+ jobs = HawatelSearchJobs::Api::Xing.page({:query_key => result.key})
39
+ expect(jobs.page).to eq(0)
40
+ end
41
+
42
+ it "call page() with specified page" do
43
+ jobs = HawatelSearchJobs::Api::Xing.page({:query_key => result.key, :page => 1})
44
+ expect(jobs.page).to eq(1)
45
+ end
46
+
48
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hawatel_search_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Przemyslaw Mantaj
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-14 00:00:00.000000000 Z
12
+ date: 2016-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xing_api