Class: CabezaDeTermo::JsonSpec::IsEmailExpectation

Inherits:
Expectation show all
Defined in:
lib/cabeza-de-termo/json-spec/expectations/is-email-expectation.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, #set_json_spec

Methods inherited from AbstractExpectation

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

Instance Method Details

#is_satisfied_by?(value_holder) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/cabeza-de-termo/json-spec/expectations/is-email-expectation.rb', line 7

def is_satisfied_by?(value_holder)
	is_valid_email?(value_holder.value)
end

#is_valid_email?(value) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/cabeza-de-termo/json-spec/expectations/is-email-expectation.rb', line 11

def is_valid_email?(value)
	ValidatesEmailFormatOf.validate_email_format(value).nil?
end