class DataMapper::Matchers::HaveManyThrough

Public Class Methods

new(children, broker) click to toggle source
# File lib/dm/matchers/have_many_through.rb, line 5
def initialize(children, broker)
  @children, @broker = children, broker
end

Public Instance Methods

description() click to toggle source
# File lib/dm/matchers/have_many_through.rb, line 26
def description
  "has many #{@children} through #{@broker}"
end
failure_message() click to toggle source
# File lib/dm/matchers/have_many_through.rb, line 18
def failure_message
  "expected to have many #{@children} through #{@broker}"
end
failure_message_when_negated() click to toggle source
# File lib/dm/matchers/have_many_through.rb, line 22
def failure_message_when_negated
  "expected to not have many #{@children} through #{@broker}"
end
matches?(parent) click to toggle source
# File lib/dm/matchers/have_many_through.rb, line 9
def matches?(parent)
  parent_class = parent.is_a?(Class) ?  parent : parent.class
  relation = parent_class.relationships[@children.to_s]

  relation.parent_model == parent_class and
  relation.name == @children.to_sym and
  relation.options[:through] == @broker.to_sym
end