class MiniTest::Matchers::ActiveModel::ValidateAcceptanceMatcher
Public Class Methods
new(attr)
click to toggle source
Calls superclass method
# File lib/matchers/validate_acceptance_matcher.rb, line 18 def initialize attr @accepted = nil super attr, :acceptance end
Public Instance Methods
accept_with(value)
click to toggle source
# File lib/matchers/validate_acceptance_matcher.rb, line 24 def accept_with value @accepted = value self end
description()
click to toggle source
Calls superclass method
# File lib/matchers/validate_acceptance_matcher.rb, line 37 def description desc = '' desc = " accept with #{@accepted.inspect}" if @accepted super << desc end
matches?(subject)
click to toggle source
Calls superclass method
# File lib/matchers/validate_acceptance_matcher.rb, line 29 def matches? subject return false unless @result = super(subject) check_accepted_value if @accepted @result end
Private Instance Methods
check_accepted_value()
click to toggle source
# File lib/matchers/validate_acceptance_matcher.rb, line 45 def check_accepted_value actual = @validator.options[:accept] if actual == @accepted @positive_message << " accept with #{actual.inspect}." else @negative_message << " accept with #{actual.inspect}." @result = false end end