From 716dbd0a558ba3ac6e9a22591d2147aeb810a22c Mon Sep 17 00:00:00 2001 From: Jake Gavin Date: Sat, 13 Dec 2014 15:40:26 -0800 Subject: [PATCH] fix TeamsController#show --- app/controllers/teams_controller.rb | 2 +- spec/controllers/teams_controller_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb index 1b327057..896c3264 100644 --- a/app/controllers/teams_controller.rb +++ b/app/controllers/teams_controller.rb @@ -57,7 +57,7 @@ def show @job = show_params[:job_id].nil? ? @team.jobs.sample : Opportunity.with_public_id(show_params[:job_id]) @other_jobs = @team.jobs.reject { |job| job.id == @job.id } unless @job.nil? - @job_page = show_params[:job_id].present? + @job_page = !@job.nil? return render(:premium) if show_premium_page? end diff --git a/spec/controllers/teams_controller_spec.rb b/spec/controllers/teams_controller_spec.rb index a8e39684..32283fa6 100644 --- a/spec/controllers/teams_controller_spec.rb +++ b/spec/controllers/teams_controller_spec.rb @@ -36,6 +36,16 @@ expect(response).to be_success expect(response).to have_http_status(200) end + it 'sets job_page to true if job is found' do + opporunity = Fabricate(:opportunity) + get :show, slug: opportunity.team.slug, job_id: opportunity.public_id + expect(assigns(:job_page)).to eq(true) + end + it 'sets job_page to false if job is not found' do + team = Fabricate(:team) + get :show, slug: team.slug, job_id: 'not-a-real-job-slug' + expect(assigns(:job_page)).to eq(false) + end end describe '#create' do