diff options
Diffstat (limited to 'spec/arel/unit')
-rw-r--r-- | spec/arel/unit/primitives/attribute_spec.rb | 2 | ||||
-rw-r--r-- | spec/arel/unit/primitives/expression_spec.rb | 2 | ||||
-rw-r--r-- | spec/arel/unit/relations/alias_spec.rb | 2 | ||||
-rw-r--r-- | spec/arel/unit/relations/deletion_spec.rb | 4 | ||||
-rw-r--r-- | spec/arel/unit/relations/relation_spec.rb | 10 | ||||
-rw-r--r-- | spec/arel/unit/relations/update_spec.rb | 6 | ||||
-rw-r--r-- | spec/arel/unit/relations/where_spec.rb (renamed from spec/arel/unit/relations/selection_spec.rb) | 12 |
7 files changed, 19 insertions, 19 deletions
diff --git a/spec/arel/unit/primitives/attribute_spec.rb b/spec/arel/unit/primitives/attribute_spec.rb index 890ac0e813..b341c6f88e 100644 --- a/spec/arel/unit/primitives/attribute_spec.rb +++ b/spec/arel/unit/primitives/attribute_spec.rb @@ -16,7 +16,7 @@ module Arel describe '#bind' do it "manufactures an attribute with the relation bound and self as an ancestor" do - derived_relation = @relation.select(@relation[:id].eq(1)) + derived_relation = @relation.where(@relation[:id].eq(1)) @attribute.bind(derived_relation).should == Attribute.new(derived_relation, @attribute.name, :ancestor => @attribute) end diff --git a/spec/arel/unit/primitives/expression_spec.rb b/spec/arel/unit/primitives/expression_spec.rb index 8a990231f6..d398805fe2 100644 --- a/spec/arel/unit/primitives/expression_spec.rb +++ b/spec/arel/unit/primitives/expression_spec.rb @@ -14,7 +14,7 @@ module Arel describe '#bind' do it "manufactures an attribute with a rebound relation and self as the ancestor" do - derived_relation = @relation.select(@relation[:id].eq(1)) + derived_relation = @relation.where(@relation[:id].eq(1)) @expression.bind(derived_relation).should == Expression.new(@attribute.bind(derived_relation), "COUNT", nil, @expression) end diff --git a/spec/arel/unit/relations/alias_spec.rb b/spec/arel/unit/relations/alias_spec.rb index ce35debadf..5327154fa8 100644 --- a/spec/arel/unit/relations/alias_spec.rb +++ b/spec/arel/unit/relations/alias_spec.rb @@ -17,7 +17,7 @@ module Arel describe 'when there is no ambiguity' do it 'does not alias table names anywhere a table name can appear' do @relation \ - .select(@relation[:id].eq(1)) \ + .where(@relation[:id].eq(1)) \ .order(@relation[:id]) \ .project(@relation[:id]) \ .group(@relation[:id]) \ diff --git a/spec/arel/unit/relations/deletion_spec.rb b/spec/arel/unit/relations/deletion_spec.rb index f975720d83..46c2ec9143 100644 --- a/spec/arel/unit/relations/deletion_spec.rb +++ b/spec/arel/unit/relations/deletion_spec.rb @@ -14,8 +14,8 @@ module Arel ") end - it 'manufactures sql deleting a selection relation' do - Deletion.new(@relation.select(@relation[:id].eq(1))).to_sql.should be_like(" + it 'manufactures sql deleting a where relation' do + Deletion.new(@relation.where(@relation[:id].eq(1))).to_sql.should be_like(" DELETE FROM `users` WHERE `users`.`id` = 1 diff --git a/spec/arel/unit/relations/relation_spec.rb b/spec/arel/unit/relations/relation_spec.rb index d9ae8e0742..78e391640e 100644 --- a/spec/arel/unit/relations/relation_spec.rb +++ b/spec/arel/unit/relations/relation_spec.rb @@ -78,22 +78,22 @@ module Arel end end - describe '#select' do + describe '#where' do before do @predicate = Equality.new(@attribute1, @attribute2) end - it "manufactures a selection relation" do - @relation.select(@predicate).should == Selection.new(@relation, @predicate) + it "manufactures a where relation" do + @relation.where(@predicate).should == Where.new(@relation, @predicate) end it "accepts arbitrary strings" do - @relation.select("arbitrary").should == Selection.new(@relation, "arbitrary") + @relation.where("arbitrary").should == Where.new(@relation, "arbitrary") end describe 'when given a blank predicate' do it 'returns self' do - @relation.select.should == @relation + @relation.where.should == @relation end end end diff --git a/spec/arel/unit/relations/update_spec.rb b/spec/arel/unit/relations/update_spec.rb index f411781392..08c6da7901 100644 --- a/spec/arel/unit/relations/update_spec.rb +++ b/spec/arel/unit/relations/update_spec.rb @@ -48,15 +48,15 @@ module Arel end end - describe 'when the relation is a selection' do + describe 'when the relation is a where' do before do @update = Update.new( - @relation.select(@relation[:id].eq(1)), + @relation.where(@relation[:id].eq(1)), @relation[:name] => "nick" ) end - it 'manufactures sql updating a selection relation' do + it 'manufactures sql updating a where relation' do @update.to_sql.should be_like(" UPDATE `users` SET `users`.`name` = 'nick' diff --git a/spec/arel/unit/relations/selection_spec.rb b/spec/arel/unit/relations/where_spec.rb index 20807f952f..aa14fd7bdc 100644 --- a/spec/arel/unit/relations/selection_spec.rb +++ b/spec/arel/unit/relations/where_spec.rb @@ -1,24 +1,24 @@ require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper') module Arel - describe Selection do + describe Where do before do @relation = Table.new(:users) @predicate = @relation[:id].eq(1) end describe '#initialize' do - it "manufactures nested selection relations if multiple predicates are provided" do + it "manufactures nested where relations if multiple predicates are provided" do another_predicate = @relation[:name].lt(2) - Selection.new(@relation, @predicate, another_predicate). \ - should == Selection.new(Selection.new(@relation, another_predicate), @predicate) + 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 - Selection.new(@relation, @predicate).to_sql.should be_like(" + Where.new(@relation, @predicate).to_sql.should be_like(" SELECT `users`.`id`, `users`.`name` FROM `users` WHERE `users`.`id` = 1 @@ -28,7 +28,7 @@ module Arel describe 'when given a string' do it "passes the string through to the where clause" do - Selection.new(@relation, 'asdf').to_sql.should be_like(" + Where.new(@relation, 'asdf').to_sql.should be_like(" SELECT `users`.`id`, `users`.`name` FROM `users` WHERE asdf |