Sha256: 8fbf2c743c0a2945a56d2ef9cc0f853e09be7b9b2a9a40da84194ee8d9a3cdf1

Contents?: true

Size: 694 Bytes

Versions: 9

Compression:

Stored size: 694 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

9 entries across 9 versions & 1 rubygems

Version Path
ruby_ext-0.5.9 spec/core/open_object_spec.rb
ruby_ext-0.5.8 spec/core/open_object_spec.rb
ruby_ext-0.5.7 spec/core/open_object_spec.rb
ruby_ext-0.5.6 spec/core/open_object_spec.rb
ruby_ext-0.5.5 spec/core/open_object_spec.rb
ruby_ext-0.5.4 spec/core/open_object_spec.rb
ruby_ext-0.5.3 spec/core/open_object_spec.rb
ruby_ext-0.5.2 spec/core/open_object_spec.rb
ruby_ext-0.5.1 spec/core/open_object_spec.rb