SusSourceSusReceiveTimes

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 condition Object

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 output Output

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 assertions Assertions

The assertions instance to use.

parameter subject Integer

The call count to check.

Implementation

def call(assertions, subject)
	assertions.nested(self) do |assertions|
		Expect.new(assertions, subject).to(@condition)
	end
end