class Spectator::Mocks::ReceiveCountExpectation(T)
- Spectator::Mocks::ReceiveCountExpectation(T)
- Reference
- Object
Overview
Expectation that checks if a stubbable object received a method call the specified number of times.
Included Modules
Defined in:
spectator/mocks/receive_count_expectation.crConstructors
-
.new(method_name : Symbol, count : CountUnion)
Creates an expectation that will match all calls with a specific method name.
-
.new(stub : T, count : CountUnion)
Creates an expectation with a stub.
-
.new(method_name : Symbol, count : Int = 1)
Creates an expectation that will match all calls with a specific method name.
Instance Method Summary
-
#failure_message(actual_value)
Error message displayed when the expectation fails.
-
#match(actual_value : Stubbable)
Checks if a stubbable object received a call defined by this expectation.
-
#match(actual_value)
Fallback method that produces a compiler error message when attempting to check a non-stubbable object.
-
#negative_failure_message(actual_value)
Error message displayed when the expectation fails in the negated case.
-
#time
Returns itself - this is for the fluent syntax.
-
#times
Returns itself - this is for the fluent syntax.
Instance methods inherited from module Spectator::Mocks::ReceiveExpectationModifiers
with(*args, **kwargs)
with
Constructor Detail
Creates an expectation that will match all calls with a specific method name.
Creates an expectation with a stub. A stub is used to pattern match calls made to an object.
Creates an expectation that will match all calls with a specific method name.
Instance Method Detail
Checks if a stubbable object received a call defined by this expectation.
Fallback method that produces a compiler error message when attempting to check a non-stubbable object.
Error message displayed when the expectation fails in the negated case.
Returns itself - this is for the fluent syntax.
double.should have_received(:some_method).exactly(1).time
double.should have_received(:some_method).at_least(1).time
double.should have_received(:some_method).at_most(1).time
Returns itself - this is for the fluent syntax.
double.should have_received(:some_method).exactly(3).times
double.should have_received(:some_method).at_least(3).times
double.should have_received(:some_method).at_most(3).times