hawatel_search_jobs 0.1.0 → 0.1.1

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.
@@ -1,53 +1,59 @@
1
- require 'spec_helper'
2
-
3
- describe HawatelSearchJobs::Api::CareerJet do
4
-
5
- let(:client) { return HawatelSearchJobs::Client.new }
6
- let(:result) {
7
- return HawatelSearchJobs::Api::CareerJet.search(
8
- :settings => HawatelSearchJobs.careerjet,
9
- :query => { :keywords => 'ruby', :company => '' }
10
- )
11
- }
12
-
13
- before(:each) do
14
- HawatelSearchJobs.configure do |config|
15
- config.careerjet[:api] = 'public.api.careerjet.net'
16
- end
17
- end
18
-
19
- it "metadata from search() result" do
20
- expect(result.totalResults).to be_a_kind_of(Integer)
21
- expect(result.page).to be_a_kind_of(Integer)
22
- expect(result.last).to be_a_kind_of(Integer)
23
- expect(result.key).to be_a_kind_of(String)
24
- end
25
-
26
- it "job attributes from search() result" do
27
- expect(result.jobs.size).to be > 0
28
- result.jobs.each do |job|
29
- expect(job.jobtitle).to be_a_kind_of(String)
30
- expect(job.url).to include('http')
31
- end
32
- end
33
-
34
- it "call page() without page param (default 0)" do
35
- jobs = HawatelSearchJobs::Api::CareerJet.page({:query_key => result.key})
36
- expect(jobs.page).to eq(0)
37
- end
38
-
39
- it "call page() with specified page" do
40
- jobs = HawatelSearchJobs::Api::CareerJet.page({:query_key => result.key, :page => 2})
41
- expect(jobs.page).to eq(2)
42
- end
43
-
44
- it "call search() with location param" do
45
- result = HawatelSearchJobs::Api::CareerJet.search(:settings => HawatelSearchJobs.careerjet,
46
- :query => { :keywords => 'ruby', :location => 'London' })
47
- result.jobs.each do |job|
48
- expect(job.location).to include("London")
49
- end
50
- end
51
-
52
-
1
+ require 'spec_helper'
2
+
3
+ describe HawatelSearchJobs::Api::CareerJet do
4
+
5
+ let(:client) { return HawatelSearchJobs::Client.new }
6
+ let(:result) {
7
+ return HawatelSearchJobs::Api::CareerJet.search(
8
+ :settings => HawatelSearchJobs.careerjet,
9
+ :query => { :keywords => 'ruby', :company => '' }
10
+ )
11
+ }
12
+
13
+ before(:each) do
14
+ HawatelSearchJobs.configure do |config|
15
+ config.careerjet[:api] = 'public.api.careerjet.net'
16
+ end
17
+ end
18
+
19
+ it "metadata from search() result" do
20
+ expect(result.totalResults).to be_a_kind_of(Integer)
21
+ expect(result.page).to be_a_kind_of(Integer)
22
+ expect(result.last).to be_a_kind_of(Integer)
23
+ expect(result.key).to be_a_kind_of(String)
24
+ end
25
+
26
+ it "job attributes from search() result" do
27
+ expect(result.jobs.size).to be > 0
28
+ result.jobs.each do |job|
29
+ expect(job.jobtitle).to be_a_kind_of(String)
30
+ expect(job.url).to include('http')
31
+ end
32
+ end
33
+
34
+ it "call page() without page param (default 0)" do
35
+ jobs = HawatelSearchJobs::Api::CareerJet.page({:query_key => result.key})
36
+ expect(jobs.page).to eq(0)
37
+ end
38
+
39
+ it "call page() with specified page" do
40
+ jobs = HawatelSearchJobs::Api::CareerJet.page({:query_key => result.key, :page => 2})
41
+ expect(jobs.page).to eq(2)
42
+ end
43
+
44
+ it "call search() with location param" do
45
+ result = HawatelSearchJobs::Api::CareerJet.search(:settings => HawatelSearchJobs.careerjet,
46
+ :query => { :keywords => 'ruby', :location => 'London' })
47
+ location_found = false
48
+ result.jobs.each do |job|
49
+ if job.location =~ /London/
50
+ location_found = true
51
+ break
52
+ end
53
+ end
54
+
55
+ expect(location_found).to eq(true)
56
+ end
57
+
58
+
53
59
  end
data/spec/client_spec.rb CHANGED
@@ -1,62 +1,62 @@
1
- require 'spec_helper'
2
-
3
- describe HawatelSearchJobs::Client do
4
- before(:each) do
5
- HawatelSearchJobs.configure do |config|
6
- config.indeed[:activated] = true
7
- config.indeed[:publisher] = ''
8
-
9
- config.xing[:activated] = true
10
- config.xing[:consumer_key] = 'd'
11
- config.xing[:consumer_secret] = ''
12
- config.xing[:oauth_token] = ''
13
- config.xing[:oauth_token_secret] = ''
14
-
15
- config.reed[:activated] = true
16
- config.reed[:clientid] = ''
17
-
18
- config.careerbuilder[:activated]= true
19
- config.careerbuilder[:clientid] = ''
20
-
21
- config.careerjet[:activated] =true
22
- config.careerjet[:api] = 'public.api.careerjet.net'
23
- end
24
- end
25
-
26
- let(:client) { HawatelSearchJobs::Client.new }
27
-
28
- xit '#search valid data' do
29
- client.search_jobs({:keywords => 'ruby'})
30
- valid_jobs_table(client)
31
- end
32
-
33
- xit '#search count method' do
34
- client.search_jobs({:keywords => 'ruby'})
35
- expect(client.count).to be_kind_of(Integer)
36
- end
37
-
38
- xit '#next valid data' do
39
- client.search_jobs({:keywords => 'ruby'})
40
-
41
- valid_page_number(0, client)
42
- valid_jobs_table(client)
43
- client.next
44
-
45
- valid_page_number(1, client)
46
- valid_jobs_table(client)
47
- end
48
-
49
- private
50
- def valid_jobs_table(client)
51
- expect(client.jobs_table).not_to be_nil
52
- client.jobs_table.each do |provider, result|
53
- expect(result.totalResults).to be >= 0
54
- end
55
- end
56
-
57
- def valid_page_number(page, client)
58
- client.jobs_table.each do |provider, result|
59
- expect(result.page).to be == page
60
- end
61
- end
1
+ require 'spec_helper'
2
+
3
+ describe HawatelSearchJobs::Client do
4
+ before(:each) do
5
+ HawatelSearchJobs.configure do |config|
6
+ config.indeed[:activated] = true
7
+ config.indeed[:publisher] = ''
8
+
9
+ config.xing[:activated] = true
10
+ config.xing[:consumer_key] = 'd'
11
+ config.xing[:consumer_secret] = ''
12
+ config.xing[:oauth_token] = ''
13
+ config.xing[:oauth_token_secret] = ''
14
+
15
+ config.reed[:activated] = true
16
+ config.reed[:clientid] = ''
17
+
18
+ config.careerbuilder[:activated]= true
19
+ config.careerbuilder[:clientid] = ''
20
+
21
+ config.careerjet[:activated] =true
22
+ config.careerjet[:api] = 'public.api.careerjet.net'
23
+ end
24
+ end
25
+
26
+ let(:client) { HawatelSearchJobs::Client.new }
27
+
28
+ xit '#search valid data' do
29
+ client.search_jobs({:keywords => 'ruby'})
30
+ valid_jobs_table(client)
31
+ end
32
+
33
+ xit '#search count method' do
34
+ client.search_jobs({:keywords => 'ruby'})
35
+ expect(client.count).to be_kind_of(Integer)
36
+ end
37
+
38
+ xit '#next valid data' do
39
+ client.search_jobs({:keywords => 'ruby'})
40
+
41
+ valid_page_number(0, client)
42
+ valid_jobs_table(client)
43
+ client.next
44
+
45
+ valid_page_number(1, client)
46
+ valid_jobs_table(client)
47
+ end
48
+
49
+ private
50
+ def valid_jobs_table(client)
51
+ expect(client.jobs_table).not_to be_nil
52
+ client.jobs_table.each do |provider, result|
53
+ expect(result.totalResults).to be >= 0
54
+ end
55
+ end
56
+
57
+ def valid_page_number(page, client)
58
+ client.jobs_table.each do |provider, result|
59
+ expect(result.page).to be == page
60
+ end
61
+ end
62
62
  end
data/spec/indeed_spec.rb CHANGED
@@ -1,62 +1,62 @@
1
- require 'spec_helper'
2
-
3
- describe "HawatelSearchJobs::Api::Indeed" do
4
-
5
- before(:each) do
6
- HawatelSearchJobs.configure do |config|
7
- config.indeed[:api] = 'api.indeed.com'
8
- config.indeed[:publisher] = ''
9
- end
10
- end
11
-
12
- let(:client) { return HawatelSearchJobs::Client.new }
13
- let(:result) {
14
- return HawatelSearchJobs::Api::Indeed.search(
15
- :settings => HawatelSearchJobs.indeed,
16
- :query => { :keywords => 'ruby', :company => '' }
17
- )}
18
-
19
- xit "metadata from search() result" do
20
- expect(result.totalResults).to be_a_kind_of(Integer)
21
- expect(result.page).to be_a_kind_of(Integer)
22
- expect(result.last).to be_a_kind_of(Integer)
23
- expect(result.key).to include("http")
24
- end
25
-
26
- xit "job attrubutes from search() result" do
27
- expect(result.jobs.size).to be > 0
28
- result.jobs.each do |job|
29
- expect(job.jobtitle).to be_a_kind_of(String)
30
- expect(job.location).to be_a_kind_of(String)
31
- expect(job.company).to be_a_kind_of(String)
32
- expect(job.url).to include('http')
33
- end
34
- end
35
-
36
- xit "call page() without page param (default 0)" do
37
- jobs = HawatelSearchJobs::Api::Indeed.page({:query_key => result.key})
38
- expect(jobs.page).to eq(0)
39
- end
40
-
41
- xit "call page() with specified page" do
42
- jobs = HawatelSearchJobs::Api::Indeed.page({:query_key => result.key, :page => 1})
43
- expect(jobs.page).to eq(1)
44
- end
45
-
46
- xit "call search() with providing location param" do
47
- result = HawatelSearchJobs::Api::Indeed.search(:settings => HawatelSearchJobs.indeed, :query => {:location => 'US'})
48
- result.jobs.each do |job|
49
- expect(job.location).to include("US")
50
- end
51
- end
52
-
53
-
54
- xit "call search() with providing company param" do
55
- result = HawatelSearchJobs::Api::Indeed.search(:settings => HawatelSearchJobs.indeed, :query => {:company => 'ibm'})
56
- result.jobs.each do |job|
57
- expect(job.company).to eq("IBM")
58
- end
59
- end
60
-
61
-
1
+ require 'spec_helper'
2
+
3
+ describe "HawatelSearchJobs::Api::Indeed" do
4
+
5
+ before(:each) do
6
+ HawatelSearchJobs.configure do |config|
7
+ config.indeed[:api] = 'api.indeed.com'
8
+ config.indeed[:publisher] = ''
9
+ end
10
+ end
11
+
12
+ let(:client) { return HawatelSearchJobs::Client.new }
13
+ let(:result) {
14
+ return HawatelSearchJobs::Api::Indeed.search(
15
+ :settings => HawatelSearchJobs.indeed,
16
+ :query => { :keywords => 'ruby', :company => '' }
17
+ )}
18
+
19
+ xit "metadata from search() result" do
20
+ expect(result.totalResults).to be_a_kind_of(Integer)
21
+ expect(result.page).to be_a_kind_of(Integer)
22
+ expect(result.last).to be_a_kind_of(Integer)
23
+ expect(result.key).to include("http")
24
+ end
25
+
26
+ xit "job attrubutes from search() result" do
27
+ expect(result.jobs.size).to be > 0
28
+ result.jobs.each do |job|
29
+ expect(job.jobtitle).to be_a_kind_of(String)
30
+ expect(job.location).to be_a_kind_of(String)
31
+ expect(job.company).to be_a_kind_of(String)
32
+ expect(job.url).to include('http')
33
+ end
34
+ end
35
+
36
+ xit "call page() without page param (default 0)" do
37
+ jobs = HawatelSearchJobs::Api::Indeed.page({:query_key => result.key})
38
+ expect(jobs.page).to eq(0)
39
+ end
40
+
41
+ xit "call page() with specified page" do
42
+ jobs = HawatelSearchJobs::Api::Indeed.page({:query_key => result.key, :page => 1})
43
+ expect(jobs.page).to eq(1)
44
+ end
45
+
46
+ xit "call search() with providing location param" do
47
+ result = HawatelSearchJobs::Api::Indeed.search(:settings => HawatelSearchJobs.indeed, :query => {:location => 'US'})
48
+ result.jobs.each do |job|
49
+ expect(job.location).to include("US")
50
+ end
51
+ end
52
+
53
+
54
+ xit "call search() with providing company param" do
55
+ result = HawatelSearchJobs::Api::Indeed.search(:settings => HawatelSearchJobs.indeed, :query => {:company => 'ibm'})
56
+ result.jobs.each do |job|
57
+ expect(job.company).to eq("IBM")
58
+ end
59
+ end
60
+
61
+
62
62
  end
data/spec/reed_spec.rb CHANGED
@@ -1,81 +1,81 @@
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
+ 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
81
81
  end