aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/unit/relations/insert_spec.rb
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2009-05-16 21:13:32 -0400
committerBryan Helmkamp <bryan@brynary.com>2009-05-17 13:17:07 -0400
commit49d119ae84bbb7cd180ca855cf48997dc731554c (patch)
tree3bae397d3e2b5ee76bd89a87ccbf421d814fec74 /spec/arel/unit/relations/insert_spec.rb
parent4096d192a1e7cdf0115f5a4cf33d102b176cb8cd (diff)
downloadrails-49d119ae84bbb7cd180ca855cf48997dc731554c.tar.gz
rails-49d119ae84bbb7cd180ca855cf48997dc731554c.tar.bz2
rails-49d119ae84bbb7cd180ca855cf48997dc731554c.zip
Adding spec:mysql and spec:sqlite3 tasks
Diffstat (limited to 'spec/arel/unit/relations/insert_spec.rb')
-rw-r--r--spec/arel/unit/relations/insert_spec.rb75
1 files changed, 53 insertions, 22 deletions
diff --git a/spec/arel/unit/relations/insert_spec.rb b/spec/arel/unit/relations/insert_spec.rb
index 441c97b290..2fd07dd96c 100644
--- a/spec/arel/unit/relations/insert_spec.rb
+++ b/spec/arel/unit/relations/insert_spec.rb
@@ -8,24 +8,35 @@ module Arel
describe '#to_sql' do
it 'manufactures sql inserting data when given multiple rows' do
- pending 'it should insert multiple rows'
- @insertion = Insert.new(@relation, [@relation[:name] => "nick", @relation[:name] => "bryan"])
+ pending 'it should insert multiple rows' do
+ @insertion = Insert.new(@relation, [@relation[:name] => "nick", @relation[:name] => "bryan"])
- @insertion.to_sql.should be_like("
- INSERT
- INTO `users`
- (`name`) VALUES ('nick'), ('bryan')
- ")
+ @insertion.to_sql.should be_like("
+ INSERT
+ INTO `users`
+ (`name`) VALUES ('nick'), ('bryan')
+ ")
+ end
end
it 'manufactures sql inserting data when given multiple values' do
@insertion = Insert.new(@relation, @relation[:id] => "1", @relation[:name] => "nick")
- @insertion.to_sql.should be_like("
- INSERT
- INTO `users`
- (`id`, `name`) VALUES (1, 'nick')
- ")
+ adapter_is :mysql do
+ @insertion.to_sql.should be_like(%Q{
+ INSERT
+ INTO `users`
+ (`id`, `name`) VALUES (1, 'nick')
+ })
+ end
+
+ adapter_is_not :mysql do
+ @insertion.to_sql.should be_like(%Q{
+ INSERT
+ INTO "users"
+ ("id", "name") VALUES (1, 'nick')
+ })
+ end
end
describe 'when given values whose types correspond to the types of the attributes' do
@@ -34,11 +45,21 @@ module Arel
end
it 'manufactures sql inserting data' do
- @insertion.to_sql.should be_like("
- INSERT
- INTO `users`
- (`name`) VALUES ('nick')
- ")
+ adapter_is :mysql do
+ @insertion.to_sql.should be_like(%Q{
+ INSERT
+ INTO `users`
+ (`name`) VALUES ('nick')
+ })
+ end
+
+ adapter_is_not :mysql do
+ @insertion.to_sql.should be_like(%Q{
+ INSERT
+ INTO "users"
+ ("name") VALUES ('nick')
+ })
+ end
end
end
@@ -48,11 +69,21 @@ module Arel
end
it 'manufactures sql inserting data' do
- @insertion.to_sql.should be_like("
- INSERT
- INTO `users`
- (`id`) VALUES (1)
- ")
+ adapter_is :mysql do
+ @insertion.to_sql.should be_like(%Q{
+ INSERT
+ INTO `users`
+ (`id`) VALUES (1)
+ })
+ end
+
+ adapter_is_not :mysql do
+ @insertion.to_sql.should be_like(%Q{
+ INSERT
+ INTO "users"
+ ("id") VALUES (1)
+ })
+ end
end
end
end