Class: Mongoid::Matchers::AcceptNestedAttributesForMatcher
- Inherits:
-
Object
- Object
- Mongoid::Matchers::AcceptNestedAttributesForMatcher
- Defined in:
- lib/matchers/accept_nested_attributes.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(attribute) ⇒ AcceptNestedAttributesForMatcher
constructor
A new instance of AcceptNestedAttributesForMatcher.
- #matches?(subject) ⇒ Boolean
- #negative_failure_message ⇒ Object (also: #failure_message_when_negated)
Constructor Details
#initialize(attribute) ⇒ AcceptNestedAttributesForMatcher
Returns a new instance of AcceptNestedAttributesForMatcher.
16 17 18 19 |
# File 'lib/matchers/accept_nested_attributes.rb', line 16 def initialize(attribute) @attribute = attribute.to_s @options = {} end |
Instance Method Details
#description ⇒ Object
36 37 38 |
# File 'lib/matchers/accept_nested_attributes.rb', line 36 def description description = "accepts_nested_attributes_for :#{@attribute}" end |
#failure_message ⇒ Object
26 27 28 |
# File 'lib/matchers/accept_nested_attributes.rb', line 26 def "Expected #{expectation} (#{@problem})" end |
#matches?(subject) ⇒ Boolean
21 22 23 24 |
# File 'lib/matchers/accept_nested_attributes.rb', line 21 def matches?(subject) @subject = subject match? end |
#negative_failure_message ⇒ Object Also known as: failure_message_when_negated
30 31 32 |
# File 'lib/matchers/accept_nested_attributes.rb', line 30 def "Did not expect #{expectation}" end |