Class: CabezaDeTermo::JsonSpec::BlockExpectation

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

Instance Method Summary collapse

Methods inherited from Expectation

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

Methods inherited from AbstractExpectation

#accept_walker, #explain, #failed_message_on, #set_expectation_method, #set_json_spec

Constructor Details

#initialize(block, *args) ⇒ BlockExpectation

Returns a new instance of BlockExpectation.



6
7
8
9
10
11
# File 'lib/cabeza-de-termo/json-spec/expectations/block-expectation.rb', line 6

def initialize(block , *args)
	super()

	@block = block
	@args = args
end

Instance Method Details

#argsObject



13
14
15
# File 'lib/cabeza-de-termo/json-spec/expectations/block-expectation.rb', line 13

def args
	@args
end

#explain_parametersObject

Explaining



23
24
25
# File 'lib/cabeza-de-termo/json-spec/expectations/block-expectation.rb', line 23

def explain_parameters()
	'(' + args.join(', ') + ')'
end

#is_satisfied_by?(value_holder) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/cabeza-de-termo/json-spec/expectations/block-expectation.rb', line 17

def is_satisfied_by?(value_holder)
	@block.call(value_holder, *args)
end