module RR::DoubleDefinitions::DoubleDefinition::ArgumentDefinitionConstructionMethods
Public Instance Methods
with(*args, &return_value_block)
click to toggle source
Double#with sets the expectation that the Double will receive the passed in arguments.
Passing in a block sets the return value.
mock(subject).method_name.with(1, 2) {:return_value}
# File lib/rr/double_definitions/double_definition.rb, line 45 def with(*args, &return_value_block) @argument_expectation = Expectations::ArgumentEqualityExpectation.new(*args) install_method_callback return_value_block self end
with_any_args(&return_value_block)
click to toggle source
Double#with_any_args sets the expectation that the Double can receive any arguments.
Passing in a block sets the return value.
mock(subject).method_name.with_any_args {:return_value}
# File lib/rr/double_definitions/double_definition.rb, line 57 def with_any_args(&return_value_block) @argument_expectation = Expectations::AnyArgumentExpectation.new install_method_callback return_value_block self end
with_no_args(&return_value_block)
click to toggle source
Double#with_no_args sets the expectation that the Double will receive no arguments.
Passing in a block sets the return value.
mock(subject).method_name.with_no_args {:return_value}
# File lib/rr/double_definitions/double_definition.rb, line 69 def with_no_args(&return_value_block) @argument_expectation = Expectations::ArgumentEqualityExpectation.new() install_method_callback return_value_block self end