Sha256: b364862f612eca54e46eefc042d113c9103d8bdc1096390f3a2c4485795c7d6d
Contents?: true
Size: 597 Bytes
Versions: 1
Compression:
Stored size: 597 Bytes
Contents
require_relative '../../spec_helper' describe Hash do describe :metch do subject do { /aa/ => :aa, /a/ => :a, 'b' => :b } end it "must return value of matching regexp key" do _(subject.metch('abc')).must_equal :a end it "must return value of equal non-regexp key" do _(subject.metch('b')).must_equal :b end it "fails with KeyError if nothing matches" do _{ subject.metch('bcd') }.must_raise KeyError end it "returns fallback value if nothing matches" do _(subject.metch('x', :foobar)).must_equal :foobar end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aipp-0.2.5 | spec/lib/core_ext/hash_spec.rb |