Class: Mongoid::Matchers::AcceptNestedAttributesForMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/matchers/accept_nested_attributes.rb

Instance Method Summary collapse

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

#descriptionObject



34
35
36
# File 'lib/matchers/accept_nested_attributes.rb', line 34

def description
  description = "accepts_nested_attributes_for :#{@attribute}"
end

#failure_messageObject



24
25
26
# File 'lib/matchers/accept_nested_attributes.rb', line 24

def failure_message
  "Expected #{expectation} (#{@problem})"
end

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/matchers/accept_nested_attributes.rb', line 19

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

#negative_failure_messageObject Also known as: failure_message_when_negated



28
29
30
# File 'lib/matchers/accept_nested_attributes.rb', line 28

def negative_failure_message
  "Did not expect #{expectation}"
end