Sha256: 0cc30044cf5623b893dc295969f1c9655af253ceae0986fae69bbd60505851c7

Contents?: true

Size: 755 Bytes

Versions: 3

Compression:

Stored size: 755 Bytes

Contents

require "spec_helper"
require "ruby_ext/array"

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

3 entries across 3 versions & 1 rubygems

Version Path
ruby_ext-0.4.11 spec/open_object_spec.rb
ruby_ext-0.4.10 spec/open_object_spec.rb
ruby_ext-0.4.9 spec/open_object_spec.rb