class Shoulda::Matchers::ActiveModel::ValidateConfirmationOfMatcher
@private
Attributes
Public Class Methods
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 85 def initialize(attribute) super @expected_message = :confirmation @confirmation_attribute = "#{attribute}_confirmation" end
Calls superclass method
Public Instance Methods
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 103 def does_not_match?(subject) super(subject) allows_different_value || disallows_same_value || disallows_missing_confirmation end
Calls superclass method
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 95 def matches?(subject) super(subject) disallows_different_value && allows_same_value && allows_missing_confirmation end
Calls superclass method
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 91 def simple_description "validate that :#{@confirmation_attribute} matches :#{@attribute}" end
Private Instance Methods
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 113 def allows_different_value allows_value_of('different value') do |matcher| qualify_matcher(matcher, 'some value') end end
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 137 def allows_missing_confirmation allows_value_of('any value') do |matcher| qualify_matcher(matcher, nil) end end
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 125 def allows_same_value allows_value_of('same value') do |matcher| qualify_matcher(matcher, 'same value') end end
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 119 def disallows_different_value disallows_value_of('different value') do |matcher| qualify_matcher(matcher, 'some value') end end
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 143 def disallows_missing_confirmation disallows_value_of('any value') do |matcher| qualify_matcher(matcher, nil) end end
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 131 def disallows_same_value disallows_value_of('same value') do |matcher| qualify_matcher(matcher, 'same value') end end
Source
# File lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb, line 149 def qualify_matcher(matcher, confirmation_attribute_value) matcher.values_to_preset = { confirmation_attribute => confirmation_attribute_value, } matcher.with_message( @expected_message, against: confirmation_attribute, values: { attribute: attribute }, ) end