Module: VerifiedDouble::RSpecMocksSyntaxOverrides
- Defined in:
- lib/verified_double/rspec_mocks_syntax_overrides.rb
Instance Method Summary collapse
Instance Method Details
#allow(*args) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/verified_double/rspec_mocks_syntax_overrides.rb', line 3 def allow(*args) if args[0].respond_to?(:can_record_interactions?) VerifiedDouble.registry.current_double = args[0] else VerifiedDouble.registry.current_double = nil end super(*args) end |
#expect(*args) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/verified_double/rspec_mocks_syntax_overrides.rb', line 12 def expect(*args) if args[0].respond_to?(:can_record_interactions?) VerifiedDouble.registry.current_double = args[0] else VerifiedDouble.registry.current_double = nil end super(*args) end |
#receive(*args) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/verified_double/rspec_mocks_syntax_overrides.rb', line 21 def receive(*args) if VerifiedDouble.registry.current_double VerifiedDouble.registry.add_method_signature_with_current_double(args[0]) super(*args).tap {|result| result.extend(VerifiedDouble::CanRecordInteractions) } else super(*args) end end |