Sha256: 6baaf708252e723ff383e5340eed461843131da4eb68948cd8db994c3b871a02
Contents?: true
Size: 519 Bytes
Versions: 2
Compression:
Stored size: 519 Bytes
Contents
module Suhyo::HashMatchers class IncludeHash def initialize(hash) @hash = hash end def matches?(target) @target = target @hash.each do |key, value| return false unless target[key] == value end true end def failure_message "Expected hash to include #{@hash.inspect} but got #{@target.inspect}" end def negative_failure_message "Expected hash not to include #{@hash.inspect} but got #{@target.inspect}" end end def include_hash(hash) IncludeHash.new(hash) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
suhyo-0.0.6 | lib/suhyo/hash_matchers.rb |
suhyo-0.0.5 | lib/suhyo/hash_matchers.rb |