test(shared_user_context): fix positional args warning

Using positional arguments in functional tests has been deprecated
This commit is contained in:
Luis Castro 2019-07-13 11:19:53 +02:00
parent 57125774ef
commit fb638f0c26
No known key found for this signature in database
GPG key ID: 0A8F33D4C4E27639

View file

@ -95,18 +95,22 @@ RSpec.shared_context :shared_user_context do
#
expect_any_instance_of(described_class).to receive(action).and_return(ActionDispatch::IntegrationTest.new(200))
expect_any_instance_of(described_class).to receive(:render).and_return(nil)
send(method, action, *args)
send(method, action, reduce_params(*args))
expect(response.status).to eq 200
end
def reject(user_to_signin, method, action, *args)
sign_in user_to_signin if user_to_signin
send(method, action, *args)
send(method, action, reduce_params(*args))
expect(response.status).to eq 302
end
alias_method :redirects_to, :reject
def reduce_params(*args)
{ params: args.reduce({}, :merge) }
end
def fix_args( *args)
replacements = {
__our_np: nonprofit.id,