aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-13 13:08:42 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-13 13:08:42 +0530
commit83592292768de6c093eea06289470154761f3825 (patch)
tree08521cda150bd63d0c8149c370ee5458166f1169 /spec
parent182c5a0e1f6a2268557ca43ed953d23b32e0483f (diff)
downloadrails-83592292768de6c093eea06289470154761f3825.tar.gz
rails-83592292768de6c093eea06289470154761f3825.tar.bz2
rails-83592292768de6c093eea06289470154761f3825.zip
Make sure string join relations can be chained
Diffstat (limited to 'spec')
-rw-r--r--spec/arel/engines/sql/unit/relations/join_spec.rb31
1 files changed, 30 insertions, 1 deletions
diff --git a/spec/arel/engines/sql/unit/relations/join_spec.rb b/spec/arel/engines/sql/unit/relations/join_spec.rb
index e2fc4bab3d..b926c2aaab 100644
--- a/spec/arel/engines/sql/unit/relations/join_spec.rb
+++ b/spec/arel/engines/sql/unit/relations/join_spec.rb
@@ -103,7 +103,36 @@ module Arel
})
end
end
- end
+
+ it "passes the string when there are multiple string joins" do
+ relation = StringJoin.new(@relation1, "INNER JOIN asdf ON fdsa")
+ relation = StringJoin.new(relation, "INNER JOIN lifo ON fifo")
+ sql = StringJoin.new(relation, "INNER JOIN hatful ON hallow").to_sql
+
+ adapter_is :mysql do
+ sql.should be_like(%Q{
+ SELECT `users`.`id`, `users`.`name`
+ FROM `users`
+ INNER JOIN asdf ON fdsa
+ INNER JOIN lifo ON fifo
+ INNER JOIN hatful ON hallow
+ })
+ end
+
+ adapter_is_not :mysql do
+ sql.should be_like(%Q{
+ SELECT "users"."id", "users"."name"
+ FROM "users"
+ INNER JOIN asdf ON fdsa
+ INNER JOIN lifo ON fifo
+ INNER JOIN hatful ON hallow
+ })
+ end
+ end
+
+ end
+
+
end
end
end