Skip to content

Commit e676b5a

Browse files
committed
Fix kwargs usage for Ruby 2.7
1 parent 21014e4 commit e676b5a

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

lib/rails/controller/testing/integration.rb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ module Rails
44
module Controller
55
module Testing
66
module Integration
7-
http_verbs = %w(get post patch put head delete get_via_redirect post_via_redirect)
8-
http_verbs.push('xhr', 'xml_http_request') if ActionPack.version < Gem::Version.new('5.1')
7+
http_verbs = %w(get post patch put head delete)
8+
9+
if ActionPack.version < Gem::Version.new('5.1')
10+
http_verbs.push('xhr', 'xml_http_request', 'get_via_redirect', 'post_via_redirect')
11+
end
912

1013
http_verbs.each do |method|
11-
define_method(method) do |*args|
12-
reset_template_assertion
13-
super(*args)
14+
if ActionPack.version < Gem::Version.new('5.1')
15+
define_method(method) do |path, *args|
16+
reset_template_assertion
17+
super(path, *args)
18+
end
19+
else
20+
define_method(method) do |path, **args|
21+
reset_template_assertion
22+
super(path, **args)
23+
end
1424
end
1525
end
1626
end

lib/rails/controller/testing/template_assertions.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ def teardown_subscriptions
5656
end
5757
end
5858

59-
def process(*args)
59+
def process(action, **options)
6060
reset_template_assertion
61-
super
61+
super(action, **options)
6262
end
6363

6464
def reset_template_assertion

0 commit comments

Comments
 (0)