Skip to content

Commit

Permalink
Feature/jobs radius (#195)
Browse files Browse the repository at this point in the history
* SRCH-202 - scrub job keywords from query

* update yml to get key

* update jobs.rb to have options in the jobs module

* fix rspec test

* SRCH-215 - Job results by location

* update search_options_.yml

* update vcr cassettes
  • Loading branch information
peggles2 authored Dec 14, 2018
1 parent 30fca50 commit b47576f
Show file tree
Hide file tree
Showing 7 changed files with 4,734 additions and 13 deletions.
418 changes: 418 additions & 0 deletions features/vcr_cassettes/Searches_using_mobile_device/Job_search.yml

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion lib/jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module Jobs
"|#{Date.current.year.to_s}"+
"|#{BLOCKED_PHRASES}"+
"|(#{SIMPLE_SINGULARS.join('|')})s?"
SEARCH_RADIUS = 75

def self.establish_connection!
usajobs_api_config = Rails.application.secrets.jobs
Expand Down Expand Up @@ -49,7 +50,8 @@ def self.params(options)
{ Keyword: scrub_query(options[:query]),
Organization: options[:organization_codes],
LocationName: options[:location_name],
ResultsPerPage: options[:results_per_page] }
ResultsPerPage: options[:results_per_page],
Radius: SEARCH_RADIUS }
end

end
Expand Down
7 changes: 4 additions & 3 deletions spec/lib/jobs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
subject(:search) do
Jobs.search({ query:'Nursing jobs',
organization_codes: 'HE38',
location_name: 'Washington, DC, USA',
location_name: 'Baltimore, MD, USA',
results_per_page: 10 })
end
let(:usajobs_url) { 'https://data.usajobs.gov/api/search' }
Expand All @@ -18,8 +18,9 @@
expect(a_request(:get, usajobs_url).with(
query: { Keyword: 'Nursing',
Organization: 'HE38',
LocationName: 'Washington, DC, USA',
ResultsPerPage: 10 }
LocationName: 'Baltimore, MD, USA',
ResultsPerPage: 10,
Radius: 75 }
)).to have_been_made
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/govbox_set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
allow(affiliate).to receive(:agency).and_return(agency)
end

it "should call Jobs.search with the query, org codes, results per page, and location_name params" do
it "should call Jobs.search with the params" do
expect(Jobs).to receive(:search).
with(query: 'job',
organization_codes: 'ABCD;BCDE',
Expand Down

Large diffs are not rendered by default.

680 changes: 679 additions & 1 deletion spec/vcr_cassettes/jobs/search_options_.yml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit b47576f

Please sign in to comment.