Sha256: 65c24378deb03405410e6a2ce6fa711e695d548a8f84e368a2dab971f613312c
Contents?: true
Size: 739 Bytes
Versions: 9
Compression:
Stored size: 739 Bytes
Contents
module DataMapper module Matchers class BelongTo def initialize(parent) @parent = parent end def matches?(child) child_class = child.is_a?(Class) ? child : child.class relation = child_class.relationships[@parent.to_s] relation and relation.is_a?(DataMapper::Associations::ManyToOne::Relationship) and relation.child_model == child_class end def failure_message "expected to belong to #{@parent}" end def negative_failure_message "expected to not belong to #{@parent}" end def description "belongs to #{@parent}" end end def belong_to(name) BelongTo.new(name) end end end
Version data entries
9 entries across 9 versions & 2 rubygems