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.
14 15 16 17 |
# File 'lib/matchers/accept_nested_attributes.rb', line 14 def initialize(attribute) @attribute = attribute.to_s @options = {} end |
Instance Method Details
#description ⇒ Object
34 35 36 |
# File 'lib/matchers/accept_nested_attributes.rb', line 34 def description description = "accepts_nested_attributes_for :#{@attribute}" end |
#failure_message ⇒ Object
24 25 26 |
# File 'lib/matchers/accept_nested_attributes.rb', line 24 def "Expected #{expectation} (#{@problem})" end |
#matches?(subject) ⇒ Boolean
19 20 21 22 |
# File 'lib/matchers/accept_nested_attributes.rb', line 19 def matches?(subject) @subject = subject match? end |
#negative_failure_message ⇒ Object Also known as: failure_message_when_negated
28 29 30 |
# File 'lib/matchers/accept_nested_attributes.rb', line 28 def "Did not expect #{expectation}" end |