diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-03-16 16:17:13 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-03-16 16:17:13 -0700 |
commit | 07f7f752fecb56316456f144c121e471fd0d0847 (patch) | |
tree | efe4da65736e808ecae0c7850e4d1fe32470c037 /spec | |
parent | af3d7c5193eee90ad17b1ba8aaf5d76a2874c0a5 (diff) | |
download | rails-07f7f752fecb56316456f144c121e471fd0d0847.tar.gz rails-07f7f752fecb56316456f144c121e471fd0d0847.tar.bz2 rails-07f7f752fecb56316456f144c121e471fd0d0847.zip |
renamed operators
- equals / eq
- greater_than / gt
- etc.
Diffstat (limited to 'spec')
5 files changed, 19 insertions, 19 deletions
diff --git a/spec/active_relation/unit/primitives/attribute_spec.rb b/spec/active_relation/unit/primitives/attribute_spec.rb index bdd22721b3..a0f6cde8f7 100644 --- a/spec/active_relation/unit/primitives/attribute_spec.rb +++ b/spec/active_relation/unit/primitives/attribute_spec.rb @@ -16,7 +16,7 @@ module ActiveRelation describe '#bind' do it "manufactures an attribute with the relation bound and self as an ancestor" do - derived_relation = @relation.select(@relation[:id].equals(1)) + derived_relation = @relation.select(@relation[:id].eq(1)) @attribute.bind(derived_relation).should == Attribute.new(derived_relation, @attribute.name, :ancestor => @attribute) end @@ -95,33 +95,33 @@ module ActiveRelation @attribute = Attribute.new(@relation, :name) end - describe '#equals' do + describe '#eq' do it "manufactures an equality predicate" do - @attribute.equals('name').should == Equality.new(@attribute, 'name') + @attribute.eq('name').should == Equality.new(@attribute, 'name') end end - describe '#less_than' do + describe '#lt' do it "manufactures a less-than predicate" do - @attribute.less_than(10).should == LessThan.new(@attribute, 10) + @attribute.lt(10).should == LessThan.new(@attribute, 10) end end - describe '#less_than_or_equal_to' do + describe '#lteq' do it "manufactures a less-than or equal-to predicate" do - @attribute.less_than_or_equal_to(10).should == LessThanOrEqualTo.new(@attribute, 10) + @attribute.lteq(10).should == LessThanOrEqualTo.new(@attribute, 10) end end - describe '#greater_than' do + describe '#gt' do it "manufactures a greater-than predicate" do - @attribute.greater_than(10).should == GreaterThan.new(@attribute, 10) + @attribute.gt(10).should == GreaterThan.new(@attribute, 10) end end - describe '#greater_than_or_equal_to' do + describe '#gteq' do it "manufactures a greater-than or equal-to predicate" do - @attribute.greater_than_or_equal_to(10).should == GreaterThanOrEqualTo.new(@attribute, 10) + @attribute.gteq(10).should == GreaterThanOrEqualTo.new(@attribute, 10) end end diff --git a/spec/active_relation/unit/relations/deletion_spec.rb b/spec/active_relation/unit/relations/deletion_spec.rb index 27d879e96f..71ddd8d820 100644 --- a/spec/active_relation/unit/relations/deletion_spec.rb +++ b/spec/active_relation/unit/relations/deletion_spec.rb @@ -15,7 +15,7 @@ module ActiveRelation end it 'manufactures sql deleting a selection relation' do - Deletion.new(@relation.select(@relation[:id].equals(1))).to_sql.should be_like(" + Deletion.new(@relation.select(@relation[:id].eq(1))).to_sql.should be_like(" DELETE FROM `users` WHERE `users`.`id` = 1 diff --git a/spec/active_relation/unit/relations/join_spec.rb b/spec/active_relation/unit/relations/join_spec.rb index a0e94a5b65..515c9ce0f2 100644 --- a/spec/active_relation/unit/relations/join_spec.rb +++ b/spec/active_relation/unit/relations/join_spec.rb @@ -5,12 +5,12 @@ module ActiveRelation before do @relation1 = Table.new(:users) @relation2 = Table.new(:photos) - @predicate = @relation1[:id].equals(@relation2[:user_id]) + @predicate = @relation1[:id].eq(@relation2[:user_id]) end describe '==' do before do - @another_predicate = @relation1[:id].equals(1) + @another_predicate = @relation1[:id].eq(1) @another_relation = Table.new(:cameras) end @@ -96,8 +96,8 @@ module ActiveRelation end it 'manufactures sql joining the two tables, merging any selects' do - Join.new("INNER JOIN", @relation1.select(@relation1[:id].equals(1)), - @relation2.select(@relation2[:id].equals(2)), @predicate).to_sql.should be_like(" + Join.new("INNER JOIN", @relation1.select(@relation1[:id].eq(1)), + @relation2.select(@relation2[:id].eq(2)), @predicate).to_sql.should be_like(" SELECT `users`.`id`, `users`.`name`, `photos`.`id`, `photos`.`user_id`, `photos`.`camera_id` FROM `users` INNER JOIN `photos` ON `users`.`id` = `photos`.`user_id` @@ -149,7 +149,7 @@ module ActiveRelation end it "keeps selects on the aggregation within the derived table" do - Join.new("INNER JOIN", @relation1, @aggregation.select(@aggregation[:user_id].equals(1)), @predicate).to_sql.should be_like(" + Join.new("INNER JOIN", @relation1, @aggregation.select(@aggregation[:user_id].eq(1)), @predicate).to_sql.should be_like(" SELECT `users`.`id`, `users`.`name`, `photo_count`.`user_id`, `photo_count`.`cnt` FROM `users` INNER JOIN (SELECT `photos`.`user_id`, COUNT(`photos`.`id`) AS `cnt` FROM `photos` WHERE `photos`.`user_id` = 1 GROUP BY `photos`.`user_id`) AS `photo_count` diff --git a/spec/active_relation/unit/relations/relation_spec.rb b/spec/active_relation/unit/relations/relation_spec.rb index b562ec2a2a..b5e204abcf 100644 --- a/spec/active_relation/unit/relations/relation_spec.rb +++ b/spec/active_relation/unit/relations/relation_spec.rb @@ -45,7 +45,7 @@ module ActiveRelation describe Relation::Operations do describe 'joins' do before do - @predicate = @relation[:id].equals(@relation[:id]) + @predicate = @relation[:id].eq(@relation[:id]) end describe '#join' do diff --git a/spec/active_relation/unit/relations/update_spec.rb b/spec/active_relation/unit/relations/update_spec.rb index 485c86372d..9053f292d6 100644 --- a/spec/active_relation/unit/relations/update_spec.rb +++ b/spec/active_relation/unit/relations/update_spec.rb @@ -36,7 +36,7 @@ module ActiveRelation describe 'when the relation is a selection' do before do @update = Update.new( - @relation.select(@relation[:id].equals(1)), + @relation.select(@relation[:id].eq(1)), @relation[:name] => "nick".bind(@relation) ) end |