Module: 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.
3 4 5 |
# File 'lib/fakes/arg_behaviour.rb', line 3 def return_value @return_value end |
#times_called ⇒ Object
Returns the value of attribute times_called.
3 4 5 |
# File 'lib/fakes/arg_behaviour.rb', line 3 def times_called @times_called end |
Instance Method Details
#and_return(item) ⇒ Object
5 6 7 |
# File 'lib/fakes/arg_behaviour.rb', line 5 def and_return(item) @return_value = item end |
#capture_args(args) ⇒ Object
9 10 11 12 |
# File 'lib/fakes/arg_behaviour.rb', line 9 def capture_args(args) @times_called += 1 @called_args = args end |
#matches?(args) ⇒ Boolean
14 15 16 |
# File 'lib/fakes/arg_behaviour.rb', line 14 def matches?(args) return @args == args end |
#was_called_with?(args) ⇒ Boolean
18 19 20 |
# File 'lib/fakes/arg_behaviour.rb', line 18 def was_called_with?(args) return @called_args == args end |