diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-18 23:47:59 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-18 23:47:59 +0000 |
commit | 2fac5d1a8b1ebba367058aaf465f709888c44877 (patch) | |
tree | fc25735c2dae71da9d034819851f090d1bae7e39 /activerecord/test | |
parent | a9f790a748596c0ad6e61cc31b0058590f2383d2 (diff) | |
download | rails-2fac5d1a8b1ebba367058aaf465f709888c44877.tar.gz rails-2fac5d1a8b1ebba367058aaf465f709888c44877.tar.bz2 rails-2fac5d1a8b1ebba367058aaf465f709888c44877.zip |
SQL Server: test for affected row count. References #9558 [lawrence, ryepup]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7968 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/base_test.rb | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 5e20cbe127..103f9f7271 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -569,29 +569,26 @@ class BasicsTest < Test::Unit::TestCase assert_equal -2, Topic.find(2).replies_count end - # The ADO library doesn't support the number of affected rows - unless current_adapter?(:SQLServerAdapter) - def test_update_all - assert_equal 2, Topic.update_all("content = 'bulk updated!'") - assert_equal "bulk updated!", Topic.find(1).content - assert_equal "bulk updated!", Topic.find(2).content - - assert_equal 2, Topic.update_all(['content = ?', 'bulk updated again!']) - assert_equal "bulk updated again!", Topic.find(1).content - assert_equal "bulk updated again!", Topic.find(2).content - - assert_equal 2, Topic.update_all(['content = ?', nil]) - assert_nil Topic.find(1).content - end + def test_update_all + assert_equal 2, Topic.update_all("content = 'bulk updated!'") + assert_equal "bulk updated!", Topic.find(1).content + assert_equal "bulk updated!", Topic.find(2).content - def test_update_all_with_hash - assert_not_nil Topic.find(1).last_read - assert_equal 2, Topic.update_all(:content => 'bulk updated with hash!', :last_read => nil) - assert_equal "bulk updated with hash!", Topic.find(1).content - assert_equal "bulk updated with hash!", Topic.find(2).content - assert_nil Topic.find(1).last_read - assert_nil Topic.find(2).last_read - end + assert_equal 2, Topic.update_all(['content = ?', 'bulk updated again!']) + assert_equal "bulk updated again!", Topic.find(1).content + assert_equal "bulk updated again!", Topic.find(2).content + + assert_equal 2, Topic.update_all(['content = ?', nil]) + assert_nil Topic.find(1).content + end + + def test_update_all_with_hash + assert_not_nil Topic.find(1).last_read + assert_equal 2, Topic.update_all(:content => 'bulk updated with hash!', :last_read => nil) + assert_equal "bulk updated with hash!", Topic.find(1).content + assert_equal "bulk updated with hash!", Topic.find(2).content + assert_nil Topic.find(1).last_read + assert_nil Topic.find(2).last_read end if current_adapter?(:MysqlAdapter) @@ -610,9 +607,6 @@ class BasicsTest < Test::Unit::TestCase end def test_delete_all - # The ADO library doesn't support the number of affected rows - return true if current_adapter?(:SQLServerAdapter) - assert_equal 2, Topic.delete_all end |