Sha256: e689f80f9c859d546efa9ac9cccc7b2448e63c610ce61bdb0115136973a5615b

Contents?: true

Size: 906 Bytes

Versions: 7

Compression:

Stored size: 906 Bytes

Contents

require File.expand_path('../test_helper', __FILE__)

module Loquor
  class ObjectHashTest < Minitest::Test
    def test_is_accessible_as_a_hash
      representation = ObjectHash.new({foo: "bar"})
      assert_equal "bar", representation[:foo]
    end

    def test_hash_symbol_keys_are_accessible_as_strings
      representation = ObjectHash.new({foo: "bar"})
      assert_equal "bar", representation["foo"]
    end

    def test_hash_string_keys_are_accessible_as_symbols
      representation = ObjectHash.new({"foo" => "bar"})
      assert_equal "bar", representation[:foo]
    end

    def test_hash_keys_are_accessible_as_orignals
      representation = ObjectHash.new({1 => "bar"})
      assert_equal "bar", representation[1]
    end

    def test_hash_keys_are_accessible_via_methods
      representation = ObjectHash.new({foo: "bar"})
      assert_equal "bar", representation.foo
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
loquor-0.5.4 test/object_hash_test.rb
loquor-0.5.3 test/object_hash_test.rb
loquor-0.5.2 test/object_hash_test.rb
loquor-0.5.1 test/object_hash_test.rb
loquor-0.5.0 test/object_hash_test.rb
loquor-0.4.0 test/object_hash_test.rb
loquor-0.3.0 test/object_hash_test.rb