chore(shared_user_ctx): rename method for clarity

This commit is contained in:
Luis Castro 2019-08-02 19:19:56 +02:00
parent b65b88b292
commit deae69bce8
No known key found for this signature in database
GPG key ID: 0A8F33D4C4E27639

View file

@ -85,8 +85,7 @@ RSpec.shared_context :shared_user_context do
end end
def accept(user_to_signin, method, action, *args) def accept(user_to_signin, method, action, *args)
# TODO: Extract into method args verification without_json_response = method_without_json_view?(args)
without_json_response = method_has_json_view?(args)
request.accept = 'application/json' unless without_json_response request.accept = 'application/json' unless without_json_response
sign_in user_to_signin if user_to_signin sign_in user_to_signin if user_to_signin
# allows us to run the helpers but ignore what the controller action does # allows us to run the helpers but ignore what the controller action does
@ -115,7 +114,7 @@ RSpec.shared_context :shared_user_context do
{ params: args.reduce({}, :merge) } { params: args.reduce({}, :merge) }
end end
def method_has_json_view?(*args) def method_without_json_view?(*args)
args.collect do |items| args.collect do |items|
if items.kind_of?(Array) if items.kind_of?(Array)
items.each do |k, v| items.each do |k, v|