Created
July 22, 2011 08:15
-
-
Save guilleiguaran/1099073 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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