Sha256: 5806163819026f31cf81a46e248e0c841491c424844280dbbc55078cf1ba98da

Contents?: true

Size: 714 Bytes

Versions: 14

Compression:

Stored size: 714 Bytes

Contents

require "core/spec_helper"

describe 'OpenObject' do
  it 'should be comparable with hashes' do
    {}.to_openobject.should == {}
    {}.should == {}.to_openobject
    
    {a: :b}.to_openobject.should == {a: :b}
    {'a' => :b}.to_openobject.should == {a: :b}
    
    {a: :b}.to_openobject.should == {'a' => :b}
    {'a' => :b}.to_openobject.should == {'a' => :b}
    
    {a: :b}.to_openobject.should_not == {a: :c}
  end
  
  it "must be hash (from error)" do
    {}.to_openobject.is_a?(Hash).should be_true
  end
  
  it 'merge! should be indifferent to string and symbol' do
    oo = OpenObject.new
    oo.merge! a: true
    oo.a.should be_true
    oo.merge! 'b' => true    
    oo.b.should be_true
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ruby_ext-0.4.25 spec/core/open_object_spec.rb
ruby_ext-0.4.24 spec/core/open_object_spec.rb
ruby_ext-0.4.23 spec/core/open_object_spec.rb
ruby_ext-0.4.22 spec/core/open_object_spec.rb
ruby_ext-0.4.21 spec/core/open_object_spec.rb
ruby_ext-0.4.20 spec/core/open_object_spec.rb
ruby_ext-0.4.19 spec/core/open_object_spec.rb
ruby_ext-0.4.18 spec/core/open_object_spec.rb
ruby_ext-0.4.17 spec/core/open_object_spec.rb
ruby_ext-0.4.16 spec/core/open_object_spec.rb
ruby_ext-0.4.15 spec/core/open_object_spec.rb
ruby_ext-0.4.14 spec/core/open_object_spec.rb
ruby_ext-0.4.13 spec/core/open_object_spec.rb
ruby_ext-0.4.12 spec/core/open_object_spec.rb