Module RR::DoubleDefinitions::DoubleDefinition::ArgumentDefinitionConstructionMethods
In: lib/rr/double_definitions/double_definition.rb

Methods

Public Instance methods

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}

[Source]

    # File lib/rr/double_definitions/double_definition.rb, line 46
46:         def with(*args, &return_value_block)
47:           @argument_expectation = Expectations::ArgumentEqualityExpectation.new(*args)
48:           install_method_callback return_value_block
49:           self
50:         end

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}

[Source]

    # File lib/rr/double_definitions/double_definition.rb, line 58
58:         def with_any_args(&return_value_block)
59:           @argument_expectation = Expectations::AnyArgumentExpectation.new
60:           install_method_callback return_value_block
61:           self
62:         end

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}

[Source]

    # File lib/rr/double_definitions/double_definition.rb, line 70
70:         def with_no_args(&return_value_block)
71:           @argument_expectation = Expectations::ArgumentEqualityExpectation.new()
72:           install_method_callback return_value_block
73:           self
74:         end

[Validate]