Skip to content

Commit

Permalink
SRCH-94 - fix more jobs search to not return 404 (#168)
Browse files Browse the repository at this point in the history
* SRCH-94 - fix more jobs search to not return 404

* fix cucumber spec error

* fix the link to remove p=1

* pass &a= as the seperator for joined_organization_codes

* add hp=public so only public search results
  • Loading branch information
peggles2 authored Nov 9, 2018
1 parent 8bc20ff commit 4469770
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
13 changes: 9 additions & 4 deletions app/helpers/jobs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ def link_to_more_jobs(search)

def legacy_link_to_more_jobs(search)
title, url = more_jobs_title_and_url search
job_link_with_click_tracking title, url, search.affiliate, search.query, agency_jobs_link_index = -1, @search_vertical
job_link_with_click_tracking title,
url,
search.affiliate,
search.query,
agency_jobs_link_index = -1,
@search_vertical
end

def more_jobs_title_and_url(search)
Expand All @@ -89,15 +94,15 @@ def job_listed_on_usajobs?(job_id)

def more_federal_jobs_title_and_url
title = t :'searches.more_federal_job_openings'
url = 'https://www.usajobs.gov/JobSearch/Search/GetResults?PostingChannelID=USASearch'
url = 'https://www.usajobs.gov/Search/Results?hp=public'
[title, url]
end

def url_for_more_agency_jobs(agency, job_id)
case job_id
when /^usajobs/
organization_codes = agency.joined_organization_codes
"https://www.usajobs.gov/JobSearch/Search/GetResults?organizationid=#{organization_codes}&PostingChannelID=USASearch&ApplicantEligibility=all"
organization_codes = agency.joined_organization_codes('&a=')
"https://www.usajobs.gov/Search/Results?a=#{organization_codes}&hp=public"
when /^ng:/
ng_agency = job_id.split(':')[1]
"http://agency.governmentjobs.com/#{ng_agency}/default.cfm"
Expand Down
2 changes: 1 addition & 1 deletion features/mobile_searches.feature
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ Feature: Searches using mobile device
Then I should see "Federal Job Openings"
And I should see 10 job postings
And I should see an image link to "USAJobs.gov" with url for "https://www.usajobs.gov/"
And I should see a link to "More federal job openings on USAJobs.gov" with url for "https://www.usajobs.gov/JobSearch/Search/GetResults?PostingChannelID=USASearch"
And I should see a link to "More federal job openings on USAJobs.gov" with url for "https://www.usajobs.gov/Search/Results?hp=public"

Scenario: When using tablet device
Given I am using a mobile device
Expand Down
6 changes: 3 additions & 3 deletions spec/helpers/jobs_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
allow(search).to receive_message_chain(:affiliate, :agency).and_return(nil)
expect(helper).to receive(:job_link_with_click_tracking).with(
'More federal job openings on USAJobs.gov',
'https://www.usajobs.gov/JobSearch/Search/GetResults?PostingChannelID=USASearch',
'https://www.usajobs.gov/Search/Results?hp=public',
search.affiliate, 'gov', -1, nil)
helper.legacy_link_to_more_jobs(search)
end
Expand All @@ -67,7 +67,7 @@
it 'should render an organization specific link to usajobs.gov' do
expect(helper).to receive(:job_link_with_click_tracking).with(
'More GSA job openings on USAJobs.gov',
'https://www.usajobs.gov/JobSearch/Search/GetResults?organizationid=GS;HI&PostingChannelID=USASearch&ApplicantEligibility=all',
'https://www.usajobs.gov/Search/Results?a=GS&a=HI&hp=public',
search.affiliate, 'gov', -1, nil)
helper.legacy_link_to_more_jobs(search)
end
Expand All @@ -79,7 +79,7 @@
it 'should render an organization specific link to usajobs in Spanish' do
expect(helper).to receive(:job_link_with_click_tracking).with(
'Más trabajos en GSA en USAJobs.gov',
'https://www.usajobs.gov/JobSearch/Search/GetResults?organizationid=GS;HI&PostingChannelID=USASearch&ApplicantEligibility=all',
'https://www.usajobs.gov/Search/Results?a=GS&a=HI&hp=public',
search.affiliate, 'gov', -1, nil)
helper.legacy_link_to_more_jobs(search)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/views/searches/index.html.haml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@

expect(rendered).not_to have_content('Zero Money Research Job')

expect(rendered).to have_selector('a[href="https://www.usajobs.gov/JobSearch/Search/GetResults?PostingChannelID=USASearch"]',
expect(rendered).to have_selector('a[href="https://www.usajobs.gov/Search/Results?hp=public"]',
text: 'More federal job openings on USAJobs.gov')
end

Expand All @@ -186,7 +186,7 @@

it 'should show links with Spanish translations' do
render
expect(rendered).to have_selector('a[href="https://www.usajobs.gov/JobSearch/Search/GetResults?PostingChannelID=USASearch"]',
expect(rendered).to have_selector('a[href="https://www.usajobs.gov/Search/Results?hp=public"]',
text: 'Más trabajos en el gobierno federal en USAJobs.gov')
end
end
Expand Down

0 comments on commit 4469770

Please sign in to comment.