Skip to content

Instantly share code, notes, and snippets.

@jimryan
Created January 11, 2012 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jimryan/1596283 to your computer and use it in GitHub Desktop.
Save jimryan/1596283 to your computer and use it in GitHub Desktop.
def test_sets_settings_with_hash
user = User.create :name => 'Mr. Foo'
user.settings[:three] = 3
user.settings = { :one => 1, :two => 2 }
assert_equal 1, user.settings[:one]
assert_equal 2, user.settings[:two]
assert_equal 3, user.settings[:three] # ensure existing settings remain intact
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment