Browse files

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

because JRuby reports the call to __send__ in the backtrace.
  • Loading branch information...
1 parent 0eefd8d commit fc5e3ff1ba0d361b7091585094d0eca68b821108 @arunagw arunagw committed Sep 4, 2011
Showing with 6 additions and 4 deletions.
  1. +6 −4 activesupport/test/core_ext/module_test.rb
View
10 activesupport/test/core_ext/module_test.rb
@@ -183,17 +183,19 @@ def test_delegation_exception_backtrace
someone.foo
rescue NoMethodError => e
file_and_line = "#{__FILE__}:#{Someone::FAILED_DELEGATE_LINE}"
- assert e.backtrace.first.include?(file_and_line),
- "[#{e.backtrace.first}] did not 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.
+ assert e.backtrace.any?{|a| a.include?(file_and_line)},
+ "[#{e.backtrace.inspect}] did not include [#{file_and_line}]"
end
def test_delegation_exception_backtrace_with_allow_nil
someone = Someone.new("foo", "bar")
someone.bar
rescue NoMethodError => e
file_and_line = "#{__FILE__}:#{Someone::FAILED_DELEGATE_LINE_2}"
- assert e.backtrace.first.include?(file_and_line),
- "[#{e.backtrace.first}] did not 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.
+ assert e.backtrace.any?{|a| a.include?(file_and_line)},
+ "[#{e.backtrace.inspect}] did not include [#{file_and_line}]"
end
def test_parent

0 comments on commit fc5e3ff

Please sign in to comment.