Skip to content

Instantly share code, notes, and snippets.

@JosephLeon
Created July 6, 2016 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JosephLeon/4a4b9f0240b00febf319515f5da5502c to your computer and use it in GitHub Desktop.
Save JosephLeon/4a4b9f0240b00febf319515f5da5502c to your computer and use it in GitHub Desktop.
def test_default_value_is_the_same_object
hash = Hash.new([])
hash[:one] << "uno"
hash[:two] << "dos"
puts hash[:one]
assert_equal ["uno", "dos"], hash[:one]
assert_equal ["uno", "dos"], hash[:two]
assert_equal ["uno", "dos"], hash[:three]
assert_equal true, hash[:one].object_id == hash[:two].object_id
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment