Sha256: de7af8920cc85af8ff49b6e9b2de74722b5a46b0f2efb0346df631c38e7e4c27
Contents?: true
Size: 694 Bytes
Versions: 5
Compression:
Stored size: 694 Bytes
Contents
module DataMapper module Matchers class BelongTo def initialize(parent) @parent = parent end def matches?(child) @child = child relation = @child.relationships[@parent.to_s] relation and relation.is_a?(DataMapper::Associations::ManyToOne::Relationship) and relation.child_model == child 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
5 entries across 5 versions & 1 rubygems