Class: MiniTest::Matchers::ActiveModel::ValidateAcceptanceMatcher
Instance Method Summary
collapse
#failure_message, #negative_failure_message, #on, #with_message
Methods included from Helpers
#class_of, #to_sentence
Constructor Details
Returns a new instance of ValidateAcceptanceMatcher.
18
19
20
21
22
|
# File 'lib/matchers/validate_acceptance_matcher.rb', line 18
def initialize attr
@accepted = nil
super attr, :acceptance
end
|
Instance Method Details
#accept_with(value) ⇒ Object
24
25
26
27
|
# File 'lib/matchers/validate_acceptance_matcher.rb', line 24
def accept_with value
@accepted = value
self
end
|
#description ⇒ Object
37
38
39
40
41
|
# File 'lib/matchers/validate_acceptance_matcher.rb', line 37
def description
desc = ''
desc = " accept with #{@accepted.inspect}" if @accepted
super << desc
end
|
#matches?(subject) ⇒ Boolean
29
30
31
32
33
34
35
|
# 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
|