Class: CabezaDeTermo::JsonSpec::AllExpectationsComposite

Inherits:
Expectation show all
Defined in:
lib/cabeza-de-termo/json-spec/expectations/all-expectations-composite.rb

Instance Method Summary collapse

Methods inherited from Expectation

#accept_walker, #expectation_method, #explain, #explain_parameters, #failed_message_block, #failed_message_on, #json_spec, #set_expectation_method

Methods inherited from AbstractExpectation

#accept_walker, #explain, #failed_message_on, #set_expectation_method

Constructor Details

#initializeAllExpectationsComposite

Returns a new instance of AllExpectationsComposite.



6
7
8
# File 'lib/cabeza-de-termo/json-spec/expectations/all-expectations-composite.rb', line 6

def initialize()
	@child_expectations = []
end

Instance Method Details

#add_child(child_expectation) ⇒ Object



22
23
24
# File 'lib/cabeza-de-termo/json-spec/expectations/all-expectations-composite.rb', line 22

def add_child(child_expectation)
	child_expectations << child_expectation
end

#child_expectationsObject



10
11
12
# File 'lib/cabeza-de-termo/json-spec/expectations/all-expectations-composite.rb', line 10

def child_expectations
	@child_expectations
end

#is_satisfied_by?(value_holder) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
30
# File 'lib/cabeza-de-termo/json-spec/expectations/all-expectations-composite.rb', line 26

def is_satisfied_by?(value_holder)
	child_expectations.all? do |child_expectation|
		child_expectation.is_satisfied_by?(value_holder) 
	end
end

#set_json_spec(json_spec) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/cabeza-de-termo/json-spec/expectations/all-expectations-composite.rb', line 14

def set_json_spec(json_spec)
	super(json_spec)

	child_expectations.each do |child_expectation|
		child_expectation.set_json_spec(json_spec)
	end
end