aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/unit/relations/group_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/group_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/group_spec.rb')
-rw-r--r--spec/arel/unit/relations/group_spec.rb48
1 files changed, 36 insertions, 12 deletions
diff --git a/spec/arel/unit/relations/group_spec.rb b/spec/arel/unit/relations/group_spec.rb
index a0147b9416..658c0ad406 100644
--- a/spec/arel/unit/relations/group_spec.rb
+++ b/spec/arel/unit/relations/group_spec.rb
@@ -6,25 +6,49 @@ module Arel
@relation = Table.new(:users)
@attribute = @relation[:id]
end
-
+
describe '#to_sql' do
describe 'when given a predicate' do
it "manufactures sql with where clause conditions" do
- Group.new(@relation, @attribute).to_sql.should be_like("
- SELECT `users`.`id`, `users`.`name`
- FROM `users`
- GROUP BY `users`.`id`
- ")
+ sql = Group.new(@relation, @attribute).to_sql
+
+ adapter_is :mysql do
+ sql.should be_like(%Q{
+ SELECT `users`.`id`, `users`.`name`
+ FROM `users`
+ GROUP BY `users`.`id`
+ })
+ end
+
+ adapter_is_not :mysql do
+ sql.should be_like(%Q{
+ SELECT "users"."id", "users"."name"
+ FROM "users"
+ GROUP BY "users"."id"
+ })
+ end
end
end
-
+
describe 'when given a string' do
it "passes the string through to the where clause" do
- Group.new(@relation, 'asdf').to_sql.should be_like("
- SELECT `users`.`id`, `users`.`name`
- FROM `users`
- GROUP BY asdf
- ")
+ sql = Group.new(@relation, 'asdf').to_sql
+
+ adapter_is :mysql do
+ sql.should be_like(%Q{
+ SELECT `users`.`id`, `users`.`name`
+ FROM `users`
+ GROUP BY asdf
+ })
+ end
+
+ adapter_is_not :mysql do
+ sql.should be_like(%Q{
+ SELECT "users"."id", "users"."name"
+ FROM "users"
+ GROUP BY asdf
+ })
+ end
end
end
end