diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-06-23 17:18:37 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-06-23 17:18:37 -0300 |
commit | ae0c58fed1cd3aca1edd75a249fa99bc9571a8a3 (patch) | |
tree | 08e9b2ee509b6aea9dbbe5c7f24c7c37dde6796c /spec/arel/engines/sql/unit/relations/update_spec.rb | |
parent | 3e6ad6e5838d20c946d7a286cb34be12aae177ff (diff) | |
download | rails-ae0c58fed1cd3aca1edd75a249fa99bc9571a8a3.tar.gz rails-ae0c58fed1cd3aca1edd75a249fa99bc9571a8a3.tar.bz2 rails-ae0c58fed1cd3aca1edd75a249fa99bc9571a8a3.zip |
Build valid SQL query for SQLite3 and PostgreSQL when updating records with limited conditions
Diffstat (limited to 'spec/arel/engines/sql/unit/relations/update_spec.rb')
-rw-r--r-- | spec/arel/engines/sql/unit/relations/update_spec.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/spec/arel/engines/sql/unit/relations/update_spec.rb b/spec/arel/engines/sql/unit/relations/update_spec.rb index 4d728eb241..4b1d824ce5 100644 --- a/spec/arel/engines/sql/unit/relations/update_spec.rb +++ b/spec/arel/engines/sql/unit/relations/update_spec.rb @@ -1,5 +1,11 @@ require File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..', 'spec_helper') +class User + def self.primary_key + "id" + end +end + module Arel describe Update do before do @@ -45,17 +51,17 @@ module Arel adapter_is :sqlite3 do sql.should be_like(%Q{ - UPDATE "users" - SET "name" = 'nick' - LIMIT 1 + UPDATE "users" SET + "name" = 'nick' + WHERE "id" IN (SELECT "id" FROM "users" LIMIT 1) }) end adapter_is :postgresql do sql.should be_like(%Q{ - UPDATE "users" - SET "name" = E'nick' - LIMIT 1 + UPDATE "users" SET + "name" = E'nick' + WHERE "id" IN (SELECT "id" FROM "users" LIMIT 1) }) end end |