Sha256: d7e3418a38254c580dbf095c121254f5c7da76d7a4d8833e7e471f267d050664
Contents?: true
Size: 665 Bytes
Versions: 1
Compression:
Stored size: 665 Bytes
Contents
RSpec::Matchers.define :have_key do |key| chain :== do |value| @value = value end match do |hash| @has_key = hash.has_key?(key) if @value @has_key && hash[key] == @value else @has_key end end failure_message_for_should do |hash| if @value "#{hash.inspect} should have key #{key.inspect} == #{value.inspect}" else "#{hash.inspect} should have key #{key.inspect}" end end failure_message_for_should_not do |model| if @value "#{hash.inspect} should not have key #{key.inspect} == #{value.inspect}" else "#{hash.inspect} should not have key #{key.inspect}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
circuit-0.2.0 | spec/support/matchers/extended_have_key.rb |