Sha256: 942dc3690f2755dcd42301b9368ea4ddef46feb5c3c14cea2135f0549a49cd0f
Contents?: true
Size: 864 Bytes
Versions: 65
Compression:
Stored size: 864 Bytes
Contents
require "spec_helper" describe SC::HashStruct, 'method_missing' do before do hash = SC::HashStruct.new :foo => :foo end it "should map hash.foo => hash[:foo]" do hash.foo.should eql(:foo) end it "should map hash.bar = :foo => hash[:bar] = :foo" do hash[:bar].should eql(nil) hash.bar = :foo hash.bar.should eql(:foo) hash[:bar].should eql(:foo) end it "should map hash.foo? => !!hash[:foo]" do hash.foo?.should eql(true) hash.bar = 1 hash.bar?.should eql(true) hash.bar = 0 hash.bar?.should eql(0) end it "should map hash.undefined_prop? => false" do hash.undefined_prop?.should eql(false) # not defined... end it "should map hash.bar? = :foo to hash[:bar] = !!:foo" do hash.bar? = :foo hash[:bar].should eql(true) hash.bar? = 0 hash[:bar].should eql(false) end end
Version data entries
65 entries across 65 versions & 1 rubygems