Sha256: cabd6718748fbd52b736b569bfa1574c20d81696740fec7c8e78e89d356618c1

Contents?: true

Size: 689 Bytes

Versions: 5

Compression:

Stored size: 689 Bytes

Contents

require "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

5 entries across 5 versions & 1 rubygems

Version Path
ruby_ext-4.0.3 spec/core/open_object_spec.rb
ruby_ext-4.0.2 spec/core/open_object_spec.rb
ruby_ext-4.0.1 spec/core/open_object_spec.rb
ruby_ext-4.0.0 spec/core/open_object_spec.rb
ruby_ext-0.5.10 spec/core/open_object_spec.rb