Module: DevelopWithPassion::Fakes::ArgBehaviour
Instance Attribute Summary collapse
-
#return_value ⇒ Object
Returns the value of attribute return_value.
-
#times_called ⇒ Object
Returns the value of attribute times_called.
Instance Method Summary collapse
- #and_return(item) ⇒ Object
- #capture_args(args) ⇒ Object
- #matches?(args) ⇒ Boolean
- #was_called_with?(args) ⇒ Boolean
Instance Attribute Details
#return_value ⇒ Object
Returns the value of attribute return_value.
4 5 6 |
# File 'lib/developwithpassion_fakes/arg_behaviour.rb', line 4 def return_value @return_value end |
#times_called ⇒ Object
Returns the value of attribute times_called.
4 5 6 |
# File 'lib/developwithpassion_fakes/arg_behaviour.rb', line 4 def times_called @times_called end |
Instance Method Details
#and_return(item) ⇒ Object
6 7 8 |
# File 'lib/developwithpassion_fakes/arg_behaviour.rb', line 6 def and_return(item) @return_value = item end |
#capture_args(args) ⇒ Object
10 11 12 13 |
# File 'lib/developwithpassion_fakes/arg_behaviour.rb', line 10 def capture_args(args) @times_called += 1 @called_args = args end |
#matches?(args) ⇒ Boolean
15 16 17 |
# File 'lib/developwithpassion_fakes/arg_behaviour.rb', line 15 def matches?(args) return @args == args end |
#was_called_with?(args) ⇒ Boolean
19 20 21 |
# File 'lib/developwithpassion_fakes/arg_behaviour.rb', line 19 def was_called_with?(args) return @called_args == args end |