diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-19 16:21:55 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-19 16:21:55 +0000 |
commit | 69cb942d9b72d9a18f8d00c5887f2532bdda0a0f (patch) | |
tree | 309f72ad492f052ed7f8cf57b067bd618f59da60 /activerecord/test | |
parent | 88192b9b1be2bd0729073c899df42a789f264993 (diff) | |
download | rails-69cb942d9b72d9a18f8d00c5887f2532bdda0a0f.tar.gz rails-69cb942d9b72d9a18f8d00c5887f2532bdda0a0f.tar.bz2 rails-69cb942d9b72d9a18f8d00c5887f2532bdda0a0f.zip |
Changed the interface on AbstractAdapter to require that adapters return the number of affected rows on delete and update operations. Added that Base.update_all and Base.delete_all return an integer of the number of affected rows #341
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@228 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/base_test.rb | 8 | ||||
-rw-r--r-- | activerecord/test/fixtures/db_definitions/sqlite.sql | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index b80f4ff6ef..c2a105f85d 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -260,11 +260,15 @@ class BasicsTest < Test::Unit::TestCase end def test_update_all - Topic.update_all "content = 'bulk updated!'" + 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 end - + + def test_delete_all + assert_equal 2, Topic.delete_all + end + def test_update_by_condition Topic.update_all "content = 'bulk updated!'", "approved = 1" assert_equal "Have a nice day", Topic.find(1).content diff --git a/activerecord/test/fixtures/db_definitions/sqlite.sql b/activerecord/test/fixtures/db_definitions/sqlite.sql index 1e9aed1e1b..9bab9d9a15 100644 --- a/activerecord/test/fixtures/db_definitions/sqlite.sql +++ b/activerecord/test/fixtures/db_definitions/sqlite.sql @@ -33,7 +33,7 @@ CREATE TABLE 'topics' ( CREATE TABLE 'developers' ( 'id' INTEGER PRIMARY KEY NOT NULL, 'name' TEXT DEFAULT NULL, - 'salary' INTEGER 70000 + 'salary' INTEGER DEFAULT 70000 ); CREATE TABLE 'projects' ( |