Module: VerifiedDouble::CanRecordInteractions
- Defined in:
- lib/verified_double/can_record_interactions.rb
Instance Method Summary collapse
- #and_return(*return_values) ⇒ Object
- #should_receive(*args) ⇒ Object
- #stub(*args) ⇒ Object
- #with(*args) ⇒ Object
Instance Method Details
#and_return(*return_values) ⇒ Object
3 4 5 6 |
# File 'lib/verified_double/can_record_interactions.rb', line 3 def and_return(*return_values) VerifiedDouble.registry.last.return_values = [MethodSignature::Value.from(return_values[0])] super(*return_values) end |
#should_receive(*args) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/verified_double/can_record_interactions.rb', line 8 def should_receive(*args) VerifiedDouble.registry.add_method_signature(self, args[0]) super(*args).tap do |result| result.extend(VerifiedDouble::CanRecordInteractions) end end |
#stub(*args) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/verified_double/can_record_interactions.rb', line 15 def stub(*args) VerifiedDouble.registry.add_method_signature(self, args[0]) super(*args).tap do |result| result.extend(VerifiedDouble::CanRecordInteractions) end end |
#with(*args) ⇒ Object
22 23 24 25 26 |
# File 'lib/verified_double/can_record_interactions.rb', line 22 def with(*args) VerifiedDouble.registry.last.args = args.map{|arg| MethodSignature::Value.from(arg) } super(*args) end |