SusSourceSusHaveAll

class All

Represents a predicate that checks if the subject matches all of the given predicates.

Definitions

def initialize(predicates)

Initialize a new All predicate.

Signature

parameter predicates Array

The predicates to check.

Implementation

def initialize(predicates)
	@predicates = predicates
end

def print(output)

Print a representation of this predicate.

Signature

parameter output Output

The output target.

Implementation

def print(output)
	first = true
	output.write("have {")
	@predicates.each do |predicate|
		if first
			first = false
		else
			output.write(", ")
		end
		
		output.write(predicate)
	end
	output.write("}")
end

def call(assertions, subject)

Evaluate this predicate against a subject.

Signature

parameter assertions Assertions

The assertions instance to use.

parameter subject Object

The subject to evaluate.

Implementation

def call(assertions, subject)
	assertions.nested(self) do |assertions|
		@predicates.each do |predicate|
			predicate.call(assertions, subject)
		end
	end
end