test(params): fix HttpPositionalArguments

Automatic run with `bundle exec rubocop --rails --only HttpPositionalArguments --auto-correct`
This commit is contained in:
Luis Castro 2019-07-13 11:18:45 +02:00
parent c3c1311e2f
commit 57125774ef
No known key found for this signature in database
GPG key ID: 0A8F33D4C4E27639
3 changed files with 9 additions and 9 deletions

View file

@ -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
end

View file

@ -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

View file

@ -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"]