From 57125774efd3b18079f461ab7b0a3fe731f4069d Mon Sep 17 00:00:00 2001 From: Luis Castro Date: Sat, 13 Jul 2019 11:18:45 +0200 Subject: [PATCH] test(params): fix HttpPositionalArguments Automatic run with `bundle exec rubocop --rails --only HttpPositionalArguments --auto-correct` --- spec/controllers/campaigns_spec.rb | 4 ++-- spec/requests/maintenance_spec.rb | 8 ++++---- spec/requests/nonprofits/direct_debit_details_spec.rb | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/controllers/campaigns_spec.rb b/spec/controllers/campaigns_spec.rb index 0841b4b6..4673e8b0 100644 --- a/spec/controllers/campaigns_spec.rb +++ b/spec/controllers/campaigns_spec.rb @@ -60,7 +60,7 @@ describe CampaignsController, :type => :controller do describe 'routes' do it "routes campaigns#index" do - expect(:get => "/nonprofits/5/campaigns/4").to(route_to(:controller => "campaigns", :action => "show", nonprofit_id: "5", id: "4")) + expect(get: "/nonprofits/5/campaigns/4").to(route_to(controller: "campaigns", action: "show", nonprofit_id: "5", id: "4")) end end -end \ No newline at end of file +end diff --git a/spec/requests/maintenance_spec.rb b/spec/requests/maintenance_spec.rb index 0a79ef56..fa563ea9 100644 --- a/spec/requests/maintenance_spec.rb +++ b/spec/requests/maintenance_spec.rb @@ -60,7 +60,7 @@ describe 'Maintenance Mode' do end it 'redirects sign_in if the token is wrong' do - get(:new, {maintenance_token: "#{token}3"}) + get(:new, params: { maintenance_token: "#{token}3" }) expect(response.code).to eq "302" expect(response.location).to eq page end @@ -73,18 +73,18 @@ describe 'Maintenance Mode' do it 'redirects sign_in if the token is passed in wrong param' do - get(:new, {maintnancerwrwer_token: "#{token}"}) + get(:new, params: { maintnancerwrwer_token: "#{token}" }) expect(response.code).to eq "302" expect(response.location).to eq page end it 'allows sign_in if the token is passed' do - get(:new, {maintenance_token: "#{token}"}) + get(:new, params: { maintenance_token: "#{token}" }) expect(response.code).to eq '200' end it 'allows sign_in.json' do - get(:new, {maintenance_token: "#{token}", format: 'json'}) + get(:new, params: { maintenance_token: "#{token}", format: 'json' }) expect(response.code).to eq '200' end end diff --git a/spec/requests/nonprofits/direct_debit_details_spec.rb b/spec/requests/nonprofits/direct_debit_details_spec.rb index 4114ad37..35e13b46 100644 --- a/spec/requests/nonprofits/direct_debit_details_spec.rb +++ b/spec/requests/nonprofits/direct_debit_details_spec.rb @@ -18,21 +18,21 @@ describe DirectDebitDetailsController, type: :request do describe 'requires params' do it 'is valid when sepa_params, donation_id and supporter_id are present' do - post "/sepa", valid_params + post "/sepa", params: valid_params assert_response 200 assert_equal nil, JSON.parse(@response.body)["errors"] end it 'is not valid without sepa_params' do - post "/sepa", valid_params.except(:sepa_params) + post "/sepa", params: valid_params.except(:sepa_params) assert_response 422 assert_equal ["sepa_params required"], JSON.parse(@response.body)["errors"] end it 'is not valid without supporter_id' do - post "/sepa", valid_params.except(:supporter_id) + post "/sepa", params: valid_params.except(:supporter_id) assert_response 422 assert_equal ["supporter_id required"], JSON.parse(@response.body)["errors"]