Class: Easy::Matchers::Validations::ValidateConfirmationOfMatcher
Instance Attribute Summary collapse
#attributes, #failure_message, #failure_message_when_negated, #options, #subject, #type
Instance Method Summary
collapse
#class_name
Constructor Details
Returns a new instance of ValidateConfirmationOfMatcher.
11
12
13
14
|
# File 'lib/matchers/validations/confirmation_of.rb', line 11
def initialize(attributes)
super(attributes, :confirmation)
@confirmation_attributes = attributes
end
|
Instance Attribute Details
#confirmation_attributes ⇒ Object
Returns the value of attribute confirmation_attributes.
9
10
11
|
# File 'lib/matchers/validations/confirmation_of.rb', line 9
def confirmation_attributes
@confirmation_attributes
end
|
Instance Method Details
#allow_blank(value = true) ⇒ Object
57
58
59
60
|
# File 'lib/matchers/validations/confirmation_of.rb', line 57
def allow_blank(value = true)
options[:allow_blank] = value
self
end
|
#allow_nil(value = true) ⇒ Object
52
53
54
55
|
# File 'lib/matchers/validations/confirmation_of.rb', line 52
def allow_nil(value = true)
options[:allow_nil] = value
self
end
|
#description ⇒ Object
28
29
30
|
# File 'lib/matchers/validations/confirmation_of.rb', line 28
def description
"require #{ confirmation_attributes.join(', ') } to match #{ attributes.join(', ') }"
end
|
#if(symbol_name) ⇒ Object
37
38
39
40
|
# File 'lib/matchers/validations/confirmation_of.rb', line 37
def if(symbol_name)
options[:if] = symbol_name
self
end
|
#matches?(subject) ⇒ Boolean
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/matchers/validations/confirmation_of.rb', line 16
def matches?(subject)
super(subject)
matched_validator = class_name.validators.detect do |validator|
validator.kind == type &&
validator.attributes.sort == attributes.sort &&
validator.options.sort == options.sort
end
true if matched_validator
end
|
#on(context) ⇒ Object
47
48
49
50
|
# File 'lib/matchers/validations/confirmation_of.rb', line 47
def on(context)
options[:on] = context
self
end
|
#strict(value) ⇒ Object
62
63
64
65
|
# File 'lib/matchers/validations/confirmation_of.rb', line 62
def strict(value)
options[:strict] = value
self
end
|
#unless(symbol_name) ⇒ Object
42
43
44
45
|
# File 'lib/matchers/validations/confirmation_of.rb', line 42
def unless(symbol_name)
options[:unless] = symbol_name
self
end
|
#with_message(message) ⇒ Object
32
33
34
35
|
# File 'lib/matchers/validations/confirmation_of.rb', line 32
def with_message(message)
options[:message] = message
self
end
|