Skip to content

Instantly share code, notes, and snippets.

@cgunther
Forked from jimryan/gist:1596283
Created January 11, 2012 19:21
Show Gist options
  • Save cgunther/1596287 to your computer and use it in GitHub Desktop.
Save cgunther/1596287 to your computer and use it in GitHub Desktop.
def test_sets_settings_with_hash
user = User.create :name => 'Mr. Foo'
user.settings[:one] = 1
user.settings[:two] = 2
user.settings = { :two => 'two', :three => 3 }
assert_equal 1, user.settings[:one]
assert_equal 'two', 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