Sha256: 2d97aa32706f209fd48f652037f7160d43bced4f3036aa30f4da692fef6ced54
Contents?: true
Size: 1.31 KB
Versions: 43
Compression:
Stored size: 1.31 KB
Contents
module BsonMatchers class BeBsonEql def initialize(expected) @expected = expected end def matches?(target) @target = target @target == @expected end def failure_message "expected\...#{@target.inspect}\n" + "to be BSON code equivalent to\...#{@expected.inspect}\n" + "Difference:\...#{@expected.diff(@target).inspect}" end def negative_failure_message "expected\...#{@target.inspect}\n" + "to be BSON code different from\...#{@expected.inspect}" end end class BeMongoEql def initialize(expected, include_id) @include_id = include_id @expected = include_id ? expected : expected.except('_id') end def matches?(target) @target = @include_id ? target : target.except('_id') @target == @expected end def failure_message "expected\...#{@target.inspect}\n" + "to be BSON code equivalent to\...#{@expected.inspect}\n" + "Difference:\...#{@expected.diff(@target).inspect}" end def negative_failure_message "expected\...#{@target.inspect}\n" + "to be BSON code different from\...#{@expected.inspect}" end end def be_bson_eql(expected) BeBsonEql.new(expected) end def be_mongo_eql(expected, include_id = true) BeMongoEql.new(expected, include_id) end end
Version data entries
43 entries across 43 versions & 3 rubygems