Sha256: c179a18fb12a5992d15cb1b7891399550b9518608ca05675d27a59e1c68f5a47

Contents?: true

Size: 863 Bytes

Versions: 7

Compression:

Stored size: 863 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 { expect(wildcard_match?({ a: 2 }, matcher, &debugger)).to be false }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wildcard_matchers-0.9.1 spec/wildcard_matchers/matchers/hash_includes_spec.rb
wildcard_matchers-0.9.0 spec/wildcard_matchers/matchers/hash_includes_spec.rb
wildcard_matchers-0.4.0 spec/wildcard_matchers/matchers/hash_includes_spec.rb
wildcard_matchers-0.3.1 spec/wildcard_matchers/matchers/hash_includes_spec.rb
wildcard_matchers-0.3.0 spec/wildcard_matchers/matchers/hash_includes_spec.rb
wildcard_matchers-0.2.1 spec/wildcard_matchers/matchers/hash_includes_spec.rb
wildcard_matchers-0.2.0 spec/wildcard_matchers/matchers/hash_includes_spec.rb