Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: rspec/rspec-mocks
...
head fork: rspec/rspec-mocks
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 10 additions and 9 deletions.
  1. +10 −9 lib/rspec/mocks/any_instance/recorder.rb
19 lib/rspec/mocks/any_instance/recorder.rb
View
@@ -170,15 +170,16 @@ def already_observing?(method_name)
end
def observe!(method_name)
- stop_observing!(method_name) if already_observing?(method_name)
- @observed_methods << method_name
- backup_method!(method_name)
- @klass.class_eval(<<-EOM, __FILE__, __LINE__)
- def #{method_name}(*args, &blk)
- self.class.__recorder.playback!(self, :#{method_name})
- self.__send__(:#{method_name}, *args, &blk)
- end
- EOM
+ unless already_observing?(method_name)
+ @observed_methods << method_name
+ backup_method!(method_name)
+ @klass.class_eval(<<-EOM, __FILE__, __LINE__)
+ def #{method_name}(*args, &blk)
+ self.class.__recorder.playback!(self, :#{method_name})
+ self.__send__(:#{method_name}, *args, &blk)
+ end
+ EOM
+ end
end
def mark_invoked!(method_name)

No commit comments for this range

Something went wrong with that request. Please try again.