diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-07-30 10:15:26 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-07-30 10:16:28 -0300 |
commit | 2f930df518077bb2a00ab6d6a6cf579f0d88e250 (patch) | |
tree | 217db866b94f113b5e4ed4f6eed1eb76b1f2571e /activerecord/test/cases/persistence_test.rb | |
parent | cc712f2072e2bfd16db83239dd163eb3a488c45e (diff) | |
download | rails-2f930df518077bb2a00ab6d6a6cf579f0d88e250.tar.gz rails-2f930df518077bb2a00ab6d6a6cf579f0d88e250.tar.bz2 rails-2f930df518077bb2a00ab6d6a6cf579f0d88e250.zip |
Revert "Add update_columns and the suggestion of using update_columns
instead of update_column"
This reverts commit 9fa06c3d9811113259cb6e00a3a8454b3974add7.
This reverts commit 17a64de4980683da3ca3c185205013a29a8cf88d.
This reverts commit def9c85ffbdcf63e6c412b6bd4abafaa32ccdb5c, reversing
changes made to 6b7d26cf3c061907aedc44f7f36776c9b36950fd.
Reason: This was supposed to be released with 3.2.7 before the
suggestion to use update_column. Since it was not release now is not
good to suggest to use another method because it will confusing the
people.
Diffstat (limited to 'activerecord/test/cases/persistence_test.rb')
-rw-r--r-- | activerecord/test/cases/persistence_test.rb | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index b66c9bf7ce..aec4f99e71 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -524,63 +524,6 @@ class PersistencesTest < ActiveRecord::TestCase assert_equal 'super_title', t.title end - def test_update_columns - topic = Topic.find(1) - topic.update_columns("approved" => true, :title => "Sebastian Topic") - assert topic.approved? - assert_equal "Sebastian Topic", topic.title - topic.reload - assert topic.approved? - assert_equal "Sebastian Topic", topic.title - end - - def test_update_columns_should_raise_exception_if_new_record - topic = Topic.new - assert_raises(ActiveRecord::ActiveRecordError) { topic.update_columns(:approved => false) } - end - - def test_update_columns_should_not_leave_the_object_dirty - topic = Topic.find(1) - topic.update_attributes("content" => "Have a nice day", :author_name => "Jose") - - topic.reload - topic.update_columns(:content => "You too", "author_name" => "Sebastian") - assert_equal [], topic.changed - - topic.reload - topic.update_columns(:content => "Have a nice day", :author_name => "Jose") - assert_equal [], topic.changed - end - - def test_update_columns_with_one_readonly_attribute - minivan = Minivan.find('m1') - prev_color = minivan.color - prev_name = minivan.name - assert_raises(ActiveRecord::ActiveRecordError) { minivan.update_columns(:name => "My old minivan", :color => 'black') } - assert_equal prev_color, minivan.color - assert_equal prev_name, minivan.name - - minivan.reload - assert_equal prev_color, minivan.color - assert_equal prev_name, minivan.name - end - - def test_update_columns_should_not_modify_updated_at - developer = Developer.find(1) - prev_month = Time.now.prev_month - - developer.update_column(:updated_at, prev_month) - assert_equal prev_month, developer.updated_at - - developer.update_columns(:salary => 80000) - assert_equal prev_month, developer.updated_at - assert_equal 80000, developer.salary - - developer.reload - assert_equal prev_month.to_i, developer.updated_at.to_i - assert_equal 80000, developer.salary - end - def test_update_attributes topic = Topic.find(1) assert !topic.approved? |