mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Improve AS::TimeWithZone
error message on NoMethodError
Because we re-use the message generated by the `Time` instance it causes `TimeWithZone` to still pretend being a `Time` instance even with `remove_deprecated_time_with_zone_name = true` which is confusing.
This commit is contained in:
parent
57201658e7
commit
517a2803f4
2 changed files with 2 additions and 2 deletions
|
@ -542,7 +542,7 @@ module ActiveSupport
|
|||
def method_missing(sym, *args, &block)
|
||||
wrap_with_time_zone time.__send__(sym, *args, &block)
|
||||
rescue NoMethodError => e
|
||||
raise e, e.message.sub(time.inspect, inspect), e.backtrace
|
||||
raise e, e.message.sub(time.inspect, inspect).sub("Time", "ActiveSupport::TimeWithZone"), e.backtrace
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1078,7 +1078,7 @@ class TimeWithZoneTest < ActiveSupport::TestCase
|
|||
e = assert_raises(NoMethodError) {
|
||||
@twz.this_method_does_not_exist
|
||||
}
|
||||
assert_equal "undefined method `this_method_does_not_exist' for Fri, 31 Dec 1999 19:00:00.000000000 EST -05:00:Time", e.message
|
||||
assert_equal "undefined method `this_method_does_not_exist' for Fri, 31 Dec 1999 19:00:00.000000000 EST -05:00:ActiveSupport::TimeWithZone", e.message
|
||||
assert_no_match "rescue", e.backtrace.first
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue