Sha256: 18844f3ca65ce5859f6b7c0fa89915f09981be6a91bb73b73a3b0a22188899a3

Contents?: true

Size: 859 Bytes

Versions: 2

Compression:

Stored size: 859 Bytes

Contents

require "spec_helper"

describe WildcardMatchers::Matchers::HashIncludes do
  [ [ { :a => 1, :b => 1, :c => 1 }, :hash_includes, :a, :b ],
    [ { :a => 1, :b => 1, :c => 1 }, :hash_includes, :a, :b => 1 ],
    [ { :a => 1, :b => 1, :c => 1 }, :hash_includes, :a, :b => Integer ],
  ].each do |actual, matcher, *args|
    it_behaves_like "wildcard match", actual, matcher, *args
  end

  [ [ { :a => 1, :b => 1, :c => 1 }, :hash_includes, :a, :d ],
    [ { :a => 1, :b => 1, :c => 1 }, :hash_includes, :a, :b => 2 ],
    [ { :a => 1, :b => 1, :c => 1 }, :hash_includes, :a, :b => String ],
  ].each do |actual, matcher, *args|
    it_behaves_like "not wildcard match", actual, matcher, *args
  end

  # bug
  it "cannot be corrupted" do
    matcher = hash_includes(a: 1)
    2.times { wildcard_match?({ a: 2 }, matcher, &debugger).should be_false }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wildcard_matchers-0.1.8 spec/wildcard_matchers/matchers/hash_includes_spec.rb
wildcard_matchers-0.1.7 spec/wildcard_matchers/matchers/hash_includes_spec.rb