Sha256: eb5afb49e1f537eaff8d49642609cb2c92630dc57020142c4b6750f8e1c57ba6
Contents?: true
Size: 712 Bytes
Versions: 2
Compression:
Stored size: 712 Bytes
Contents
module DataMapper module Matchers class HaveMany def initialize(children) @children = children end def matches?(parent) @parent = parent relation = @parent.relationships[@children.to_s] relation and relation.is_a?(DataMapper::Associations::OneToMany::Relationship) and relation.parent_model == parent end def failure_message "expected to have many #{@children}" end def negative_failure_message "expected to not have many #{@children}" end def description "has many #{@children}" end end def have_many(name) HaveMany.new(name) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dm-rspec-0.0.2 | lib/dm/matchers/have_many.rb |
dm-rspec-0.0.1 | lib/dm/matchers/have_many.rb |