From d51697d2bd2cdd6394cb5e665aab8ab43ce9a14a Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 18 Feb 2010 18:28:27 -0300 Subject: Added support for RETURNING primary key when available, only for PostgreSQL. --- spec/arel/engines/sql/unit/relations/insert_spec.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'spec/arel/engines/sql/unit') diff --git a/spec/arel/engines/sql/unit/relations/insert_spec.rb b/spec/arel/engines/sql/unit/relations/insert_spec.rb index 1884e32a3d..69c5bb052c 100644 --- a/spec/arel/engines/sql/unit/relations/insert_spec.rb +++ b/spec/arel/engines/sql/unit/relations/insert_spec.rb @@ -43,6 +43,7 @@ module Arel INSERT INTO "users" ("id", "name") VALUES (1, E'nick') + RETURNING "id" }) end end @@ -74,6 +75,7 @@ module Arel INSERT INTO "users" ("name") VALUES (E'nick') + RETURNING "id" }) end end @@ -93,11 +95,20 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :sqlite3 do + @insertion.to_sql.should be_like(%Q{ + INSERT + INTO "users" + ("id") VALUES (1) + }) + end + + adapter_is :postgresql do @insertion.to_sql.should be_like(%Q{ INSERT INTO "users" ("id") VALUES (1) + RETURNING "id" }) end end -- cgit v1.2.3