class DataMapper::Matchers::HaveManyAndBelongTo
Public Class Methods
new(name)
click to toggle source
# File lib/dm/matchers/have_many_and_belong_to.rb, line 5 def initialize(name) @name = name end
Public Instance Methods
description()
click to toggle source
# File lib/dm/matchers/have_many_and_belong_to.rb, line 23 def description "belongs to #{@parent}" end
failure_message()
click to toggle source
# File lib/dm/matchers/have_many_and_belong_to.rb, line 15 def failure_message "expected to have many and belong to #{@name}" end
matches?(model)
click to toggle source
# File lib/dm/matchers/have_many_and_belong_to.rb, line 9 def matches?(model) model_class = model.is_a?(Class) ? model : model.class relation = model_class.relationships[@name.to_s] relation && relation.is_a?(DataMapper::Associations::ManyToMany::Relationship) end
negative_failure_message()
click to toggle source
# File lib/dm/matchers/have_many_and_belong_to.rb, line 19 def negative_failure_message "expected to not have many and belong to #{@name}" end