Skip to content

Fix kwargs usage for Ruby 2.7 #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions lib/rails/controller/testing/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ module Rails
module Controller
module Testing
module Integration
http_verbs = %w(get post patch put head delete get_via_redirect post_via_redirect)
http_verbs.push('xhr', 'xml_http_request') if ActionPack.version < Gem::Version.new('5.1')
http_verbs = %w(get post patch put head delete)

if ActionPack.version < Gem::Version.new('5.1')
http_verbs.push('xhr', 'xml_http_request', 'get_via_redirect', 'post_via_redirect')
end

http_verbs.each do |method|
define_method(method) do |*args|
reset_template_assertion
super(*args)
if ActionPack.version < Gem::Version.new('5.1')
define_method(method) do |path, *args|
reset_template_assertion
super(path, *args)
end
else
define_method(method) do |path, **args|
reset_template_assertion
super(path, **args)
end
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rails/controller/testing/template_assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def teardown_subscriptions
end
end

def process(*args)
def process(action, **options)
reset_template_assertion
super
super(action, **options)
end

def reset_template_assertion
Expand Down