Module | Spec::Mocks::ArgumentConstraints |
In: |
lib/spec/mocks/argument_constraints.rb
|
ArgumentConstraints are messages that you can include in message expectations to match arguments against a broader check than simple equality.
With the exception of any_args() and no_args(), the constraints are all positional - they match against the arg in the given position.
Passes if object receives :message with any args at all. This is really a more explicit variation of object.should_receive(:message)
Passes if the argument responds to the specified messages.
array = [] display = mock('display') display.should_receive(:present_names).with(duck_type(:length, :each)) => passes
Passes if the argument is a hash that includes the specified key/value pairs. If the hash includes other keys, it will still pass.