aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/engines/sql/unit/relations/update_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/arel/engines/sql/unit/relations/update_spec.rb')
-rw-r--r--spec/arel/engines/sql/unit/relations/update_spec.rb38
1 files changed, 34 insertions, 4 deletions
diff --git a/spec/arel/engines/sql/unit/relations/update_spec.rb b/spec/arel/engines/sql/unit/relations/update_spec.rb
index f553490ef5..4d728eb241 100644
--- a/spec/arel/engines/sql/unit/relations/update_spec.rb
+++ b/spec/arel/engines/sql/unit/relations/update_spec.rb
@@ -17,12 +17,19 @@ module Arel
})
end
- adapter_is_not :mysql do
+ adapter_is :sqlite3 do
sql.should be_like(%Q{
UPDATE "users"
SET "id" = 1, "name" = 'nick'
})
end
+
+ adapter_is :postgresql do
+ sql.should be_like(%Q{
+ UPDATE "users"
+ SET "id" = 1, "name" = E'nick'
+ })
+ end
end
it "manufactures sql updating attributes when given a ranged relation" do
@@ -36,13 +43,21 @@ module Arel
})
end
- adapter_is_not :mysql do
+ adapter_is :sqlite3 do
sql.should be_like(%Q{
UPDATE "users"
SET "name" = 'nick'
LIMIT 1
})
end
+
+ adapter_is :postgresql do
+ sql.should be_like(%Q{
+ UPDATE "users"
+ SET "name" = E'nick'
+ LIMIT 1
+ })
+ end
end
describe 'when given values whose types correspond to the types of the attributes' do
@@ -58,12 +73,19 @@ module Arel
})
end
- adapter_is_not :mysql do
+ adapter_is :sqlite3 do
@update.to_sql.should be_like(%Q{
UPDATE "users"
SET "name" = 'nick'
})
end
+
+ adapter_is :postgresql do
+ @update.to_sql.should be_like(%Q{
+ UPDATE "users"
+ SET "name" = E'nick'
+ })
+ end
end
end
@@ -106,13 +128,21 @@ module Arel
})
end
- adapter_is_not :mysql do
+ adapter_is :sqlite3 do
@update.to_sql.should be_like(%Q{
UPDATE "users"
SET "name" = 'nick'
WHERE "users"."id" = 1
})
end
+
+ adapter_is :postgresql do
+ @update.to_sql.should be_like(%Q{
+ UPDATE "users"
+ SET "name" = E'nick'
+ WHERE "users"."id" = 1
+ })
+ end
end
end
end