aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/arel/unit')
-rw-r--r--spec/arel/unit/primitives/value_spec.rb4
-rw-r--r--spec/arel/unit/relations/delete_spec.rb10
-rw-r--r--spec/arel/unit/relations/project_spec.rb4
-rw-r--r--spec/arel/unit/relations/where_spec.rb10
4 files changed, 14 insertions, 14 deletions
diff --git a/spec/arel/unit/primitives/value_spec.rb b/spec/arel/unit/primitives/value_spec.rb
index 87425c780d..ba9a80bb49 100644
--- a/spec/arel/unit/primitives/value_spec.rb
+++ b/spec/arel/unit/primitives/value_spec.rb
@@ -5,7 +5,7 @@ module Arel
before do
@relation = Table.new(:users)
end
-
+
describe '#to_sql' do
it "appropriately quotes the value" do
Value.new(1, @relation).to_sql.should be_like('1')
@@ -25,4 +25,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/unit/relations/delete_spec.rb b/spec/arel/unit/relations/delete_spec.rb
index 46c2ec9143..fa887d20fd 100644
--- a/spec/arel/unit/relations/delete_spec.rb
+++ b/spec/arel/unit/relations/delete_spec.rb
@@ -5,7 +5,7 @@ module Arel
before do
@relation = Table.new(:users)
end
-
+
describe '#to_sql' do
it 'manufactures sql deleting a table relation' do
Deletion.new(@relation).to_sql.should be_like("
@@ -13,7 +13,7 @@ module Arel
FROM `users`
")
end
-
+
it 'manufactures sql deleting a where relation' do
Deletion.new(@relation.where(@relation[:id].eq(1))).to_sql.should be_like("
DELETE
@@ -21,7 +21,7 @@ module Arel
WHERE `users`.`id` = 1
")
end
-
+
it "manufactures sql deleting a ranged relation" do
Deletion.new(@relation.take(1)).to_sql.should be_like("
DELETE
@@ -30,7 +30,7 @@ module Arel
")
end
end
-
+
describe '#call' do
it 'executes a delete on the connection' do
deletion = Deletion.new(@relation)
@@ -39,4 +39,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/unit/relations/project_spec.rb b/spec/arel/unit/relations/project_spec.rb
index 7f531096f0..f389b18c54 100644
--- a/spec/arel/unit/relations/project_spec.rb
+++ b/spec/arel/unit/relations/project_spec.rb
@@ -50,14 +50,14 @@ module Arel
describe 'when given an expression' do
it 'manufactures sql with expressions' do
@relation.project(@attribute.count).to_sql.should be_like("
- SELECT COUNT(`users`.`id`)
+ SELECT COUNT(`users`.`id`) AS count_id
FROM `users`
")
end
it 'manufactures sql with distinct expressions' do
@relation.project(@attribute.count(true)).to_sql.should be_like("
- SELECT COUNT(DISTINCT `users`.`id`)
+ SELECT COUNT(DISTINCT `users`.`id`) AS count_id
FROM `users`
")
end
diff --git a/spec/arel/unit/relations/where_spec.rb b/spec/arel/unit/relations/where_spec.rb
index aa14fd7bdc..8ef4d54b63 100644
--- a/spec/arel/unit/relations/where_spec.rb
+++ b/spec/arel/unit/relations/where_spec.rb
@@ -6,15 +6,15 @@ module Arel
@relation = Table.new(:users)
@predicate = @relation[:id].eq(1)
end
-
+
describe '#initialize' do
it "manufactures nested where relations if multiple predicates are provided" do
- another_predicate = @relation[:name].lt(2)
+ another_predicate = @relation[:name].lt(2)
Where.new(@relation, @predicate, another_predicate). \
should == Where.new(Where.new(@relation, another_predicate), @predicate)
end
end
-
+
describe '#to_sql' do
describe 'when given a predicate' do
it "manufactures sql with where clause conditions" do
@@ -25,7 +25,7 @@ module Arel
")
end
end
-
+
describe 'when given a string' do
it "passes the string through to the where clause" do
Where.new(@relation, 'asdf').to_sql.should be_like("
@@ -37,4 +37,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end