Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
parterburn committed Sep 23, 2024
1 parent bdf88dd commit e2a78a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ GEM
method_source
rake (>= 12.2)
thor (~> 1.0)
rake (13.1.0)
rake (13.2.1)
randomized_field (1.0.0)
activerecord (>= 4.0.0)
rb-fsevent (0.10.4)
Expand Down
12 changes: 6 additions & 6 deletions spec/controllers/payments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@

describe 'edit' do
it 'should redirect to login url if not logged in' do
get :edit, { params: { id: payment.id } }
get :edit, params: { id: payment.id }
expect(response.status).to eq 302
expect(response).to redirect_to(new_user_session_url)
end

it 'should redirect to past entries path if not superuser' do
sign_in user
get :edit, { params: { id: payment.id } }
get :edit, params: { id: payment.id }
expect(response.status).to eq 302
expect(response).to redirect_to(entries_path)
end
Expand Down Expand Up @@ -96,22 +96,22 @@
end

it 'should redirect to login url if not logged in' do
expect { post :create, { params: params } }.to_not change { Payment.count }
expect { post :create, params: params }.to_not change { Payment.count }
expect(response.status).to eq 302
expect(response).to redirect_to(new_user_session_url)
end

it 'should redirect to past entries path if not superuser' do
sign_in user
expect { post :create, { params: params } }.to_not change { Payment.count }
expect { post :create, params: params }.to_not change { Payment.count }
expect(response.status).to eq 302
expect(response).to redirect_to(entries_path)
end

it 'should show create new Payment for superusers' do
sign_in superuser
post :create, { params: params }
expect { post(:create, { params: params }) }.to change { Payment.count }.by(1)
post :create, params: params
expect { post(:create, params: params) }.to change { Payment.count }.by(1)
expect(response.status).to eq 302
expect(response).to redirect_to(payments_url)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/controllers/registrations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@
end

it 'should redirect to root url if not logged in' do
post :update, { params: params }
post :update, params: params
expect(response.status).to eq 302
expect(response).to redirect_to(new_user_session_url)
end

it 'should allow user updates to basic info' do
sign_in user
expect(user.frequency.count).to eq 1
post :update, { params: params }
post :update, params: params
expect(response.status).to eq 302
expect(response).to redirect_to(edit_user_registration_url)
expect(user.reload.frequency.count).to eq 1
Expand All @@ -132,7 +132,7 @@
old_email = user.email
old_full_name = user.full_name
expect(user.frequency.count).to eq 1
post :update, { params: params.deep_merge(user: { email: Faker::Internet.email, current_password: 'wrong' }) }
post :update, params: params.deep_merge(user: { email: Faker::Internet.email, current_password: 'wrong' })
expect(response.status).to eq 302
expect(response).to redirect_to(edit_user_registration_url)
expect(user.reload.frequency).to eq ['Sun']
Expand Down

0 comments on commit e2a78a7

Please sign in to comment.