Created
January 31, 2012 10:14
-
-
Save wejn/1709758 to your computer and use it in GitHub Desktop.
Ruby Koans - About Hashes - why breaking out the hash is necessary?
This file contains hidden or 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
def test_changing_hashes | |
hash = { :one => "uno", :two => "dos" } | |
hash[:one] = "eins" | |
expected = { :one => "eins", :two => "dos" } | |
assert_equal true, expected == hash | |
assert_equal true, { :one => "eins", :two => "dos" } == hash | |
# Bonus Question: Why was "expected" broken out into a variable | |
# rather than used as a literal? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment