From e2a78a716893cd1390f4dcd39aeb2b57d84a05b4 Mon Sep 17 00:00:00 2001 From: Paul Arterburn Date: Mon, 23 Sep 2024 11:53:51 -0600 Subject: [PATCH] Update tests --- Gemfile.lock | 2 +- spec/controllers/payments_controller_spec.rb | 12 ++++++------ spec/controllers/registrations_controller_spec.rb | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 206be33e..0935c087 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/spec/controllers/payments_controller_spec.rb b/spec/controllers/payments_controller_spec.rb index 7ee9bb66..4c24b75f 100644 --- a/spec/controllers/payments_controller_spec.rb +++ b/spec/controllers/payments_controller_spec.rb @@ -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 @@ -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 diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 6be7be73..3a16f20c 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -109,7 +109,7 @@ 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 @@ -117,7 +117,7 @@ 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 @@ -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']