Skip to content

Commit 716dbd0

Browse files
committed
fix TeamsController#show
1 parent 894861d commit 716dbd0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app/controllers/teams_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def show
5757
@job = show_params[:job_id].nil? ? @team.jobs.sample : Opportunity.with_public_id(show_params[:job_id])
5858

5959
@other_jobs = @team.jobs.reject { |job| job.id == @job.id } unless @job.nil?
60-
@job_page = show_params[:job_id].present?
60+
@job_page = !@job.nil?
6161
return render(:premium) if show_premium_page?
6262
end
6363

spec/controllers/teams_controller_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@
3636
expect(response).to be_success
3737
expect(response).to have_http_status(200)
3838
end
39+
it 'sets job_page to true if job is found' do
40+
opporunity = Fabricate(:opportunity)
41+
get :show, slug: opportunity.team.slug, job_id: opportunity.public_id
42+
expect(assigns(:job_page)).to eq(true)
43+
end
44+
it 'sets job_page to false if job is not found' do
45+
team = Fabricate(:team)
46+
get :show, slug: team.slug, job_id: 'not-a-real-job-slug'
47+
expect(assigns(:job_page)).to eq(false)
48+
end
3949
end
4050

4151
describe '#create' do

0 commit comments

Comments
 (0)