Skip to content

Commit

Permalink
[ifmeorg#1737] Test if toggle updates moment.resource_recommendations…
Browse files Browse the repository at this point in the history
… in db
  • Loading branch information
S-Warmenhoven committed May 7, 2020
1 parent a7d508b commit d3d35da
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec/controllers/moments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def post_create(moment_params)
end

describe '#update' do
let!(:moment) { create(:moment, user: user) }
let(:valid_moment_params) { { why: 'updated why' } }
let!(:moment) { create(:moment, user: user, resource_recommendations: true) }
let(:valid_moment_params) { { why: 'updated why', resource_recommendations: false } }
let(:invalid_moment_params) { { why: nil } }

context 'when the user is logged in' do
Expand All @@ -147,6 +147,10 @@ def post_create(moment_params)
expect(moment.reload.why).to eq('updated why')
end

it 'updates the resource_recommendations toggle' do
expect(moment.reload.resource_recommendations).to eq(false)
end

it 'redirects to the show page' do
expect(response).to redirect_to(moment_path(moment))
end
Expand Down

0 comments on commit d3d35da

Please sign in to comment.