Module: ElabsMatchers::Matchers::ContainHash

Defined in:
lib/elabs_matchers/matchers/contain_hash.rb

Defined Under Namespace

Classes: ContainHashMatcher

Instance Method Summary (collapse)

Instance Method Details

- (Object) contain_hash(hash)

Asserts if the hash contains the supplied hash. Works with nested hashes and array of hashes.

Example: { "foo" => ["quox", { "bar" => "baz"}]}.should contain_hash({ "foo" => [{ "bar" => "baz" }]}) { "foo" => "bar", "baz" => "quox" }.should_not contain_hash({ "baz" => "bar" })

Parameters:

  • hash (Hash)

    Key => value pairs seperated by comma



53
54
55
# File 'lib/elabs_matchers/matchers/contain_hash.rb', line 53

def contain_hash(hash)
  ContainHashMatcher.new(hash)
end