Sha256: 2b23c3bd704bd0361961de3f4a8e0215e0d2f6148acbd14fabfe3cb973f93b0a
Contents?: true
Size: 1.36 KB
Versions: 7
Compression:
Stored size: 1.36 KB
Contents
require 'helper' testcase OpenHash do class_method :[] do test do o = OpenHash[:a=>1, :b=>2] o.a.assert == 1 o.b.assert == 2 end test do o = OpenHash[:a=>1, :b=>2] o.a.assert == 1 o.b.assert == 2 end end method :open? do test do o = OpenHash[:a=>1, :b=>2] o.assert.open?(:foo) o.refute.open?(:each) end end method :open! do test do o = OpenHash[:a=>1, :b=>2] o.open!(:each) o.assert.open?(:each) o.each = 10 o.each.assert == 10 end end method :close! do test do o = OpenHash[:a=>1, :b=>2] o.open!(:each) o.assert.open?(:each) o.each = 10 o.each.assert == 10 o.close!(:each) o.each.refute == 10 end end method :method_missing do test 'bang method' do o = OpenHash[] o.open!(:each) o.each = 10 o.each.assert == 10 a = [] o.each! do |k,v| a << [k,v] end a.assert == [[:each,10]] end test 'query method' do o = OpenHash[] o.a = 1 o.assert.a? o.refute.b? end end method :send do test do o = OpenHash[] o.open!(:each) o.each = 10 o.each.assert == 10 a = [] o.send(:each) do |k,v| a << [k,v] end a.assert == [[:each,10]] end end end
Version data entries
7 entries across 6 versions & 2 rubygems