diff options
-rw-r--r-- | activesupport/lib/active_support/testing/time_helpers.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/testing/time_helpers.rb b/activesupport/lib/active_support/testing/time_helpers.rb index af19c5a9f5..84cbdf9608 100644 --- a/activesupport/lib/active_support/testing/time_helpers.rb +++ b/activesupport/lib/active_support/testing/time_helpers.rb @@ -32,9 +32,10 @@ module ActiveSupport private def unstub_object(stub) - stub.object.singleton_class.send :undef_method, stub.method_name - stub.object.singleton_class.send :alias_method, stub.method_name, stub.original_method - stub.object.singleton_class.send :undef_method, stub.original_method + singleton_class = stub.object.singleton_class + singleton_class.send :undef_method, stub.method_name + singleton_class.send :alias_method, stub.method_name, stub.original_method + singleton_class.send :undef_method, stub.original_method end end |