Class: Sus::Have::All

Inherits:
Object
  • Object
show all
Defined in:
lib/sus/have/all.rb

Instance Method Summary collapse

Constructor Details

#initialize(predicates) ⇒ All

Returns a new instance of All.



9
10
11
# File 'lib/sus/have/all.rb', line 9

def initialize(predicates)
	@predicates = predicates
end

Instance Method Details

#call(assertions, subject) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/sus/have/all.rb', line 28

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


13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/sus/have/all.rb', line 13

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