class Mongoid::Matchers::AcceptNestedAttributesForMatcher
Public Class Methods
new(attribute)
click to toggle source
# File lib/matchers/accept_nested_attributes.rb, line 14 def initialize(attribute) @attribute = attribute.to_s @options = {} end
Public Instance Methods
description()
click to toggle source
# File lib/matchers/accept_nested_attributes.rb, line 34 def description description = "accepts_nested_attributes_for :#{@attribute}" end
failure_message()
click to toggle source
# File lib/matchers/accept_nested_attributes.rb, line 24 def failure_message "Expected #{expectation} (#{@problem})" end
matches?(subject)
click to toggle source
# File lib/matchers/accept_nested_attributes.rb, line 19 def matches?(subject) @subject = subject match? end
negative_failure_message()
click to toggle source
# File lib/matchers/accept_nested_attributes.rb, line 28 def negative_failure_message "Did not expect #{expectation}" end
Also aliased as: failure_message_when_negated
Protected Instance Methods
config()
click to toggle source
# File lib/matchers/accept_nested_attributes.rb, line 53 def config model_class.nested_attributes["#{@attribute}_attributes"] end
exists?()
click to toggle source
# File lib/matchers/accept_nested_attributes.rb, line 44 def exists? if config true else @problem = 'is not declared' false end end
expectation()
click to toggle source
# File lib/matchers/accept_nested_attributes.rb, line 61 def expectation "#{model_class.name} to accept nested attributes for #{@attribute}" end
match?()
click to toggle source
# File lib/matchers/accept_nested_attributes.rb, line 40 def match? exists? end
model_class()
click to toggle source
# File lib/matchers/accept_nested_attributes.rb, line 57 def model_class @subject.class end