class Times
Represents a constraint on method call count.
Definitions
AT_LEAST_ONCE = Be.new(:>=, 1)
A predicate that matches at least one call.
def initialize(condition = AT_LEAST_ONCE)
Initialize a new Times constraint.
Signature
-
parameter
conditionObject The predicate to match against the call count.
Implementation
def initialize(condition = AT_LEAST_ONCE)
@condition = condition
end
def print(output)
Print a representation of this constraint.
Signature
-
parameter
outputOutput The output target.
Implementation
def print(output)
output.write("with call count ", @condition)
end
def call(assertions, subject)
Evaluate this constraint against a call count.
Signature
-
parameter
assertionsAssertions The assertions instance to use.
-
parameter
subjectInteger The call count to check.
Implementation
def call(assertions, subject)
assertions.nested(self) do |assertions|
Expect.new(assertions, subject).to(@condition)
end
end