test(params): fix HttpPositionalArguments
Automatic run with `bundle exec rubocop --rails --only HttpPositionalArguments --auto-correct`
This commit is contained in:
parent
c3c1311e2f
commit
57125774ef
3 changed files with 9 additions and 9 deletions
|
@ -60,7 +60,7 @@ describe CampaignsController, :type => :controller do
|
||||||
|
|
||||||
describe 'routes' do
|
describe 'routes' do
|
||||||
it "routes campaigns#index" 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
|
||||||
end
|
end
|
||||||
|
|
|
@ -60,7 +60,7 @@ describe 'Maintenance Mode' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirects sign_in if the token is wrong' do
|
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.code).to eq "302"
|
||||||
expect(response.location).to eq page
|
expect(response.location).to eq page
|
||||||
end
|
end
|
||||||
|
@ -73,18 +73,18 @@ describe 'Maintenance Mode' do
|
||||||
|
|
||||||
|
|
||||||
it 'redirects sign_in if the token is passed in wrong param' 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.code).to eq "302"
|
||||||
expect(response.location).to eq page
|
expect(response.location).to eq page
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'allows sign_in if the token is passed' do
|
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'
|
expect(response.code).to eq '200'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'allows sign_in.json' do
|
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'
|
expect(response.code).to eq '200'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,21 +18,21 @@ describe DirectDebitDetailsController, type: :request do
|
||||||
|
|
||||||
describe 'requires params' do
|
describe 'requires params' do
|
||||||
it 'is valid when sepa_params, donation_id and supporter_id are present' 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_response 200
|
||||||
assert_equal nil, JSON.parse(@response.body)["errors"]
|
assert_equal nil, JSON.parse(@response.body)["errors"]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is not valid without sepa_params' do
|
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_response 422
|
||||||
assert_equal ["sepa_params required"], JSON.parse(@response.body)["errors"]
|
assert_equal ["sepa_params required"], JSON.parse(@response.body)["errors"]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is not valid without supporter_id' do
|
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_response 422
|
||||||
assert_equal ["supporter_id required"], JSON.parse(@response.body)["errors"]
|
assert_equal ["supporter_id required"], JSON.parse(@response.body)["errors"]
|
||||||
|
|
Loading…
Reference in a new issue