1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

We can't simply check the first line of the backtrace,

because JRuby reports the call to __send__ in the backtrace.
This commit is contained in:
Arun Agrawal 2011-09-04 13:18:57 +05:30
parent 0eefd8dc48
commit fc5e3ff1ba

View file

@ -183,8 +183,9 @@ class ModuleTest < Test::Unit::TestCase
someone.foo someone.foo
rescue NoMethodError => e rescue NoMethodError => e
file_and_line = "#{__FILE__}:#{Someone::FAILED_DELEGATE_LINE}" file_and_line = "#{__FILE__}:#{Someone::FAILED_DELEGATE_LINE}"
assert e.backtrace.first.include?(file_and_line), # We can't simply check the first line of the backtrace, because JRuby reports the call to __send__ in the backtrace.
"[#{e.backtrace.first}] did not include [#{file_and_line}]" assert e.backtrace.any?{|a| a.include?(file_and_line)},
"[#{e.backtrace.inspect}] did not include [#{file_and_line}]"
end end
def test_delegation_exception_backtrace_with_allow_nil def test_delegation_exception_backtrace_with_allow_nil
@ -192,8 +193,9 @@ class ModuleTest < Test::Unit::TestCase
someone.bar someone.bar
rescue NoMethodError => e rescue NoMethodError => e
file_and_line = "#{__FILE__}:#{Someone::FAILED_DELEGATE_LINE_2}" file_and_line = "#{__FILE__}:#{Someone::FAILED_DELEGATE_LINE_2}"
assert e.backtrace.first.include?(file_and_line), # We can't simply check the first line of the backtrace, because JRuby reports the call to __send__ in the backtrace.
"[#{e.backtrace.first}] did not include [#{file_and_line}]" assert e.backtrace.any?{|a| a.include?(file_and_line)},
"[#{e.backtrace.inspect}] did not include [#{file_and_line}]"
end end
def test_parent def test_parent