Sha256: b4f48b76f0cb54f9d798800dbbb8d479145b9fe17481858d839c0030ad9ed8f7
Contents?: true
Size: 546 Bytes
Versions: 2
Compression:
Stored size: 546 Bytes
Contents
# Abbreviated from http://makandra.com/notes/627-the-definitive-spec_candy-rb-rspec-helper Object.class_eval do # a should receive that executes the expected method as usual. does not work with and_return def should_receive_and_execute(method) method_called = "_#{method}_called" prototype = respond_to?(:singleton_class) ? singleton_class : metaclass prototype.class_eval do define_method method do |*args| send(method_called, *args) super end end should_receive(method_called) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aegis-2.5.3 | spec/support/spec_candy.rb |
aegis-2.5.2 | spec/support/spec_candy.rb |