Class: Shoulda::ActiveModel::Matchers::ValidationMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/shoulda/active_model/matchers/validation_matcher.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute) ⇒ ValidationMatcher

Returns a new instance of ValidationMatcher.



9
10
11
# File 'lib/shoulda/active_model/matchers/validation_matcher.rb', line 9

def initialize(attribute)
  @attribute = attribute
end

Instance Attribute Details

#failure_messageObject (readonly)

Returns the value of attribute failure_message.



7
8
9
# File 'lib/shoulda/active_model/matchers/validation_matcher.rb', line 7

def failure_message
  @failure_message
end

Instance Method Details

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/shoulda/active_model/matchers/validation_matcher.rb', line 17

def matches?(subject)
  @subject = subject
  false
end

#negative_failure_messageObject



13
14
15
# File 'lib/shoulda/active_model/matchers/validation_matcher.rb', line 13

def negative_failure_message
  @negative_failure_message || @failure_message
end