Skip to content

Commit dc2384d

Browse files
committed
Address TestERBTemplate test failure with Ruby 3.5.0dev
This commit addresses the `TestERBTemplate#test_argument_error_in_the_template_is_not_hijacked_by_strict_locals_checking` failure with Ruby 3.5.0dev including ruby/ruby@3546ced - Without this commit: ``` $ cd actionview $ ruby -v ; rm ../Gemfile.lock ; bundle ; bin/test test/template/template_test.rb:243 ruby 3.5.0dev (2025-06-24T02:39:58Z master 3546cedde3) +PRISM [x86_64-linux] ... snip ... F Failure: TestERBTemplate#test_argument_error_in_the_template_is_not_hijacked_by_strict_locals_checking [test/template/template_test.rb:249]: Expected /in ['`]hello'/ to match "/home/yahonda/src/github.com/rails/rails/actionview/test/template/template_test.rb:27:in 'TestERBTemplate::Context#hello'". bin/test test/template/template_test.rb:243 Finished in 0.006231s, 160.4981 runs/s, 481.4942 assertions/s. 1 runs, 3 assertions, 1 failures, 0 errors, 0 skips $ ``` Here are `pp error.backtrace.first` differences between Ruby versions: ```ruby $ git diff diff --git a/actionview/test/template/template_test.rb b/actionview/test/template/template_test.rb index e8fa3c8..688b5b1f0f 100644 --- a/actionview/test/template/template_test.rb +++ b/actionview/test/template/template_test.rb @@ -245,7 +245,7 @@ def test_argument_error_in_the_template_is_not_hijacked_by_strict_locals_checkin @template = new_template("<%# locals: () -%>\n<%= hello(:invalid_argument) %>") render end - + pp error.backtrace.first assert_match(/in ['`].*hello'/, error.backtrace.first) assert_instance_of ArgumentError, error.cause end $ ``` - Ruby 3.3.8 `ruby 3.3.8 (2025-04-09 revision b200bad6cd) [x86_64-linux]` "/home/yahonda/src/github.com/rails/rails/actionview/test/template/template_test.rb:27:in `hello'" - Ruby 3.4.4 `ruby 3.4.4 (2025-05-14 revision a38531fd3f) +PRISM [x86_64-linux]` "/home/yahonda/src/github.com/rails/rails/actionview/test/template/template_test.rb:27:in 'hello'" - Ruby master `ruby 3.5.0dev (2025-06-24T02:39:58Z master 3546cedde3) +PRISM [x86_64-linux]` "/home/yahonda/src/github.com/rails/rails/actionview/test/template/template_test.rb:27:in 'TestERBTemplate::Context#hello'" Refer to: ruby/ruby#13679 https://bugs.ruby-lang.org/issues/20968#change-113811
1 parent 05f0b16 commit dc2384d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

actionview/test/template/template_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def test_argument_error_in_the_template_is_not_hijacked_by_strict_locals_checkin
246246
render
247247
end
248248

249-
assert_match(/in ['`]hello'/, error.backtrace.first)
249+
assert_match(/in ['`].*hello'/, error.backtrace.first)
250250
assert_instance_of ArgumentError, error.cause
251251
end
252252

0 commit comments

Comments
 (0)