aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/integration
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-05-06 14:14:56 -0300
committerEmilio Tagua <miloops@gmail.com>2009-05-06 14:14:56 -0300
commita7dea38204f3c40e4d0c3f29ebe17af818659697 (patch)
tree3a3a912b74b15509c715ec5028b18da49bd30d44 /spec/arel/integration
parentde843c86518e4ac871d4bb5b0873bb6c184ac304 (diff)
downloadrails-a7dea38204f3c40e4d0c3f29ebe17af818659697.tar.gz
rails-a7dea38204f3c40e4d0c3f29ebe17af818659697.tar.bz2
rails-a7dea38204f3c40e4d0c3f29ebe17af818659697.zip
Don't depend engine select_value(s) method. Quoting should be performed by connection not ARel
Diffstat (limited to 'spec/arel/integration')
-rw-r--r--spec/arel/integration/joins/with_adjacency_spec.rb20
-rw-r--r--spec/arel/integration/joins/with_aggregations_spec.rb12
-rw-r--r--spec/arel/integration/joins/with_compounds_spec.rb8
3 files changed, 20 insertions, 20 deletions
diff --git a/spec/arel/integration/joins/with_adjacency_spec.rb b/spec/arel/integration/joins/with_adjacency_spec.rb
index 32109cc354..559b5bbe1a 100644
--- a/spec/arel/integration/joins/with_adjacency_spec.rb
+++ b/spec/arel/integration/joins/with_adjacency_spec.rb
@@ -7,7 +7,7 @@ module Arel
@relation2 = @relation1.alias
@predicate = @relation1[:id].eq(@relation2[:id])
end
-
+
describe 'when joining a relation to itself' do
describe '#to_sql' do
it 'manufactures sql aliasing the table and attributes properly in the join predicate and the where clause' do
@@ -18,7 +18,7 @@ module Arel
ON `users`.`id` = `users_2`.`id`
")
end
-
+
describe 'when joining with a where on the same relation' do
it 'manufactures sql aliasing the tables properly' do
@relation1 \
@@ -31,7 +31,7 @@ module Arel
ON `users`.`id` = `users_2`.`id` AND `users_2`.`id` = 1
")
end
-
+
describe 'when the where occurs before the alias' do
it 'manufactures sql aliasing the predicates properly' do
relation2 = @relation1.where(@relation1[:id].eq(1)).alias
@@ -47,12 +47,12 @@ module Arel
end
end
end
-
+
describe 'when joining the relation to itself multiple times' do
before do
@relation3 = @relation1.alias
end
-
+
describe 'when joining left-associatively' do
it 'manufactures sql aliasing the tables properly' do
@relation1 \
@@ -70,7 +70,7 @@ module Arel
")
end
end
-
+
describe 'when joining right-associatively' do
it 'manufactures sql aliasing the tables properly' do
@relation1 \
@@ -88,7 +88,7 @@ module Arel
end
end
end
-
+
describe '[]' do
describe 'when given an attribute belonging to both sub-relations' do
it 'disambiguates the relation that serves as the ancestor to the attribute' do
@@ -108,7 +108,7 @@ module Arel
.should disambiguate_attributes(compound1[:id], compound2[:id])
end
end
-
+
describe 'when the left relation is extremely compound' do
it 'disambiguates the relation that serves as the ancestor to the attribute' do
@relation1 \
@@ -119,7 +119,7 @@ module Arel
.should disambiguate_attributes(@relation1[:id], @relation2[:id])
end
end
-
+
describe 'when the right relation is extremely compound' do
it 'disambiguates the relation that serves as the ancestor to the attribute' do
@relation1 \
@@ -136,4 +136,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/integration/joins/with_aggregations_spec.rb b/spec/arel/integration/joins/with_aggregations_spec.rb
index 42248add07..2b21dcaa1e 100644
--- a/spec/arel/integration/joins/with_aggregations_spec.rb
+++ b/spec/arel/integration/joins/with_aggregations_spec.rb
@@ -7,14 +7,14 @@ module Arel
@relation2 = Arel(:photos)
@predicate = @relation1[:id].eq(@relation2[:user_id])
end
-
+
describe 'when joining aggregated relations' do
before do
@aggregation = @relation2 \
.group(@relation2[:user_id]) \
.project(@relation2[:user_id], @relation2[:id].count.as(:cnt)) \
end
-
+
describe '#to_sql' do
# CLEANUP
it '' do
@@ -25,7 +25,7 @@ module Arel
ON `users`.`id` = `photos_external`.`user_id`
")
end
-
+
describe 'with the aggregation on the right' do
it 'manufactures sql joining the left table to a derived table' do
@relation1.join(@aggregation).on(@predicate).to_sql.should be_like("
@@ -47,7 +47,7 @@ module Arel
")
end
end
-
+
describe 'with the aggregation on both sides' do
it 'it properly aliases the aggregations' do
aggregation2 = @aggregation.alias
@@ -71,7 +71,7 @@ module Arel
")
end
end
-
+
describe 'with the aggregation on the right' do
it "manufactures sql keeping wheres on the aggregation within the derived table" do
@aggregation.where(@aggregation[:user_id].eq(1)).join(@relation1).on(@predicate).to_sql.should be_like("
@@ -86,4 +86,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/integration/joins/with_compounds_spec.rb b/spec/arel/integration/joins/with_compounds_spec.rb
index acfe35b25e..95fadc23d6 100644
--- a/spec/arel/integration/joins/with_compounds_spec.rb
+++ b/spec/arel/integration/joins/with_compounds_spec.rb
@@ -7,7 +7,7 @@ module Arel
@relation2 = Arel(:photos)
@predicate = @relation1[:id].eq(@relation2[:user_id])
end
-
+
describe '#to_sql' do
describe 'when the join contains a where' do
describe 'and the where is given a string' do
@@ -24,7 +24,7 @@ module Arel
end
end
end
-
+
describe 'when a compound contains a join' do
describe 'and the compound is a where' do
it 'manufactures sql disambiguating the tables' do
@@ -43,7 +43,7 @@ module Arel
")
end
end
-
+
describe 'and the compound is a group' do
it 'manufactures sql disambiguating the tables' do
@relation1 \
@@ -62,4 +62,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end