aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/persistence_test.rb
diff options
context:
space:
mode:
authorwangjohn <wangjohn@mit.edu>2013-03-21 17:10:17 -0400
committerwangjohn <wangjohn@mit.edu>2013-06-25 20:56:58 -0700
commit926c4b95e49cc65a1d7420392c95d2193b099965 (patch)
tree910528e0c3283283d101a0b46ba91bbe452efc6b /activerecord/test/cases/persistence_test.rb
parent9218770daa9ff0e3df56f75c98c053a6f8f751c7 (diff)
downloadrails-926c4b95e49cc65a1d7420392c95d2193b099965.tar.gz
rails-926c4b95e49cc65a1d7420392c95d2193b099965.tar.bz2
rails-926c4b95e49cc65a1d7420392c95d2193b099965.zip
Raising an error when nil or non-hash is passed to update_attributes.
Diffstat (limited to 'activerecord/test/cases/persistence_test.rb')
-rw-r--r--activerecord/test/cases/persistence_test.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb
index 30dc2a34c6..6cd3e2154e 100644
--- a/activerecord/test/cases/persistence_test.rb
+++ b/activerecord/test/cases/persistence_test.rb
@@ -419,10 +419,6 @@ class PersistenceTest < ActiveRecord::TestCase
assert !Topic.find(1).approved?
end
- def test_update_attribute_does_not_choke_on_nil
- assert Topic.find(1).update(nil)
- end
-
def test_update_attribute_for_readonly_attribute
minivan = Minivan.find('m1')
assert_raises(ActiveRecord::ActiveRecordError) { minivan.update_attribute(:color, 'black') }
@@ -701,6 +697,17 @@ class PersistenceTest < ActiveRecord::TestCase
assert_equal topic.title, Topic.find(1234).title
end
+ def test_update_attributes_parameters
+ topic = Topic.find(1)
+ assert_nothing_raised do
+ topic.update_attributes({})
+ end
+
+ assert_raises(ArgumentError) do
+ topic.update_attributes(nil)
+ end
+ end
+
def test_update!
Reply.validates_presence_of(:title)
reply = Reply.find(2)