Class: MuckEngine::Models::Matchers::NestedAttributeMatcher

Inherits:
MuckMatcherBase
  • Object
show all
Defined in:
lib/muck-engine/test/models/matchers/nested_attribute_matcher.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(nested_model) ⇒ NestedAttributeMatcher

Returns a new instance of NestedAttributeMatcher.



12
13
14
# File 'lib/muck-engine/test/models/matchers/nested_attribute_matcher.rb', line 12

def initialize(nested_model)
  @nested_model = nested_model
end

Instance Method Details

#descriptionObject



25
26
27
# File 'lib/muck-engine/test/models/matchers/nested_attribute_matcher.rb', line 25

def description
  "accepts nested attributes for"
end

#failure_messageObject



21
22
23
# File 'lib/muck-engine/test/models/matchers/nested_attribute_matcher.rb', line 21

def failure_message
  "#{factory_name} does not accept nested attributes for #{@nested_model}"
end

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/muck-engine/test/models/matchers/nested_attribute_matcher.rb', line 16

def matches?(subject)
  @subject = subject
  @subject.methods.include?("#{@nested_model}_attributes=")
end