diff options
author | Bryan Helmkamp <bryan@brynary.com> | 2009-05-16 21:13:32 -0400 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2009-05-17 13:17:07 -0400 |
commit | 49d119ae84bbb7cd180ca855cf48997dc731554c (patch) | |
tree | 3bae397d3e2b5ee76bd89a87ccbf421d814fec74 /spec/arel/unit/relations/alias_spec.rb | |
parent | 4096d192a1e7cdf0115f5a4cf33d102b176cb8cd (diff) | |
download | rails-49d119ae84bbb7cd180ca855cf48997dc731554c.tar.gz rails-49d119ae84bbb7cd180ca855cf48997dc731554c.tar.bz2 rails-49d119ae84bbb7cd180ca855cf48997dc731554c.zip |
Adding spec:mysql and spec:sqlite3 tasks
Diffstat (limited to 'spec/arel/unit/relations/alias_spec.rb')
-rw-r--r-- | spec/arel/unit/relations/alias_spec.rb | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/spec/arel/unit/relations/alias_spec.rb b/spec/arel/unit/relations/alias_spec.rb index 460a0ed0df..570f315892 100644 --- a/spec/arel/unit/relations/alias_spec.rb +++ b/spec/arel/unit/relations/alias_spec.rb @@ -16,19 +16,33 @@ module Arel describe '#to_sql' do describe 'when there is no ambiguity' do it 'does not alias table names anywhere a table name can appear' do - @relation \ + sql = @relation \ .where(@relation[:id].eq(1)) \ .order(@relation[:id]) \ .project(@relation[:id]) \ .group(@relation[:id]) \ .alias \ - .to_sql.should be_like(" - SELECT `users`.`id` - FROM `users` - WHERE `users`.`id` = 1 - GROUP BY `users`.`id` - ORDER BY `users`.`id` - ") + .to_sql + + adapter_is :mysql do + sql.should be_like(%Q{ + SELECT `users`.`id` + FROM `users` + WHERE `users`.`id` = 1 + GROUP BY `users`.`id` + ORDER BY `users`.`id` + }) + end + + adapter_is_not :mysql do + sql.should be_like(%Q{ + SELECT "users"."id" + FROM "users" + WHERE "users"."id" = 1 + GROUP BY "users"."id" + ORDER BY "users"."id" + }) + end end end end |