Sha256: 3e7a6d85e322aa01f8f0c24f90faf237a36211e42220146c692a55e3cc185c32

Contents?: true

Size: 640 Bytes

Versions: 28

Compression:

Stored size: 640 Bytes

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

describe ApipieBindings::IndifferentHash do

  let(:hash) { ApipieBindings::IndifferentHash.new({
    "one" => 1,
    :two => 2,
    :nested => { "one" => 1, :two => 2},
    :nested_array => [[{"one" => 1}]] })}

  it "should allow access with symbol" do
    hash[:one].must_equal 1
  end

  it "should allow access with string" do
    hash['two'].must_equal 2
  end

  it "should allow access nested with symbol" do
    hash['nested'][:one].must_equal 1
  end

  it "should allow access nested in array with symbol" do
    hash['nested_array'][0][0][:one].must_equal 1
  end


end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
apipie-bindings-0.7.0 test/unit/indifferent_hash_test.rb
apipie-bindings-0.6.0 test/unit/indifferent_hash_test.rb
apipie-bindings-0.5.0 test/unit/indifferent_hash_test.rb
apipie-bindings-0.4.0 test/unit/indifferent_hash_test.rb
apipie-bindings-0.3.0 test/unit/indifferent_hash_test.rb
apipie-bindings-0.2.3 test/unit/indifferent_hash_test.rb
apipie-bindings-0.2.2 test/unit/indifferent_hash_test.rb
apipie-bindings-0.2.1 test/unit/indifferent_hash_test.rb
apipie-bindings-0.2.0 test/unit/indifferent_hash_test.rb
apipie-bindings-0.1.0 test/unit/indifferent_hash_test.rb
apipie-bindings-0.0.19 test/unit/indifferent_hash_test.rb
apipie-bindings-0.0.18 test/unit/indifferent_hash_test.rb
apipie-bindings-0.0.17 test/unit/indifferent_hash_test.rb
apipie-bindings-0.0.16 test/unit/indifferent_hash_test.rb
apipie-bindings-0.0.15 test/unit/indifferent_hash_test.rb
apipie-bindings-0.0.14 test/unit/indifferent_hash_test.rb
apipie-bindings-0.0.13 test/unit/indifferent_hash_test.rb
apipie-bindings-0.0.12 test/unit/indifferent_hash_test.rb
apipie-bindings-0.0.11 test/unit/indifferent_hash_test.rb
apipie-bindings-0.0.10 test/unit/indifferent_hash_test.rb