Module: Fakes::ArgBehaviour

Included in:
ArgSet, IgnoreSet
Defined in:
lib/fakes/arg_behaviour.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#return_valueObject

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_calledObject

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

Returns:

  • (Boolean)


14
15
16
# File 'lib/fakes/arg_behaviour.rb', line 14

def matches?(args)
  return @args == args
end

#was_called_with?(args) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/fakes/arg_behaviour.rb', line 18

def was_called_with?(args)
  return @called_args == args
end