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.



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

#descriptionObject



36
37
38
# File 'lib/matchers/accept_nested_attributes.rb', line 36

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

#failure_messageObject



26
27
28
# File 'lib/matchers/accept_nested_attributes.rb', line 26

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

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/matchers/accept_nested_attributes.rb', line 21

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

#negative_failure_messageObject Also known as: failure_message_when_negated



30
31
32
# File 'lib/matchers/accept_nested_attributes.rb', line 30

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