Sha256: 1f45b35a86de8f580dd2f714e94ccf3a775ffc67f2f7fae57cec40d0e5b2efed

Contents?: true

Size: 775 Bytes

Versions: 6

Compression:

Stored size: 775 Bytes

Contents

require "#{File.dirname __FILE__}/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

6 entries across 6 versions & 2 rubygems

Version Path
ruby_ext-0.4.7 spec/open_object_spec.rb
ruby_ext-0.4.6 spec/open_object_spec.rb
ruby-ext-0.4.6 spec/open_object_spec.rb
ruby-ext-0.4.4 spec/open_object_spec.rb
ruby-ext-0.4.3 spec/ruby_ext/open_object_spec.rb
ruby-ext-0.4.2 spec/ruby_ext/open_object_spec.rb