Skip to content

Instantly share code, notes, and snippets.

@guilleiguaran
Created July 22, 2011 08:15
Show Gist options
  • Save guilleiguaran/1099073 to your computer and use it in GitHub Desktop.
Save guilleiguaran/1099073 to your computer and use it in GitHub Desktop.
require "minitest/autorun"
begin ; require "turn" ; rescue LoadError ; end
require "active_support/core_ext/hash/indifferent_access"
class TestHashes < MiniTest::Unit::TestCase
def setup
@hash1 = {a: 1}
@hash2 = {a: 1}.with_indifferent_access
end
def test_regular_hash
assert @hash1[:a]
assert_nil @hash1['a']
end
def test_hash_with_indifferent_access
assert @hash2[:a]
assert @hash2['a']
assert_equal @hash2['a'], @hash2[:a]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment