aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/active_relation/integration/scratch_spec.rb8
-rw-r--r--spec/active_relation/relations/attribute_spec.rb32
2 files changed, 20 insertions, 20 deletions
diff --git a/spec/active_relation/integration/scratch_spec.rb b/spec/active_relation/integration/scratch_spec.rb
index cd4b4cd004..6aa27bc1fe 100644
--- a/spec/active_relation/integration/scratch_spec.rb
+++ b/spec/active_relation/integration/scratch_spec.rb
@@ -40,7 +40,7 @@ describe 'ActiveRelation', 'A proposed refactoring to ActiveRecord, introducing
@photos = Photo.relation
@cameras = Camera.relation
# A first taste of a Relational Algebra: User.find(1)
- @user = @users.select(@users[:id] == 1)
+ @user = @users.select(@users[:id].equals(1))
# == is overridden on attributes to return a predicate, not true or false
end
@@ -51,14 +51,14 @@ describe 'ActiveRelation', 'A proposed refactoring to ActiveRecord, introducing
primary_key = User.reflections[:photos].klass.primary_key.to_sym
foreign_key = User.reflections[:photos].primary_key_name.to_sym
- user_relation.outer_join(@photos).on(user_relation[primary_key] == @photos[foreign_key])
+ user_relation.outer_join(@photos).on(user_relation[primary_key].equals(@photos[foreign_key]))
end
def photo_belongs_to_camera(photo_relation)
primary_key = Photo.reflections[:camera].klass.primary_key.to_sym
foreign_key = Photo.reflections[:camera].primary_key_name.to_sym
- photo_relation.outer_join(@cameras).on(photo_relation[foreign_key] == @cameras[primary_key])
+ photo_relation.outer_join(@cameras).on(photo_relation[foreign_key].equals(@cameras[primary_key]))
end
describe 'Relational Algebra', 'a relational algebra allows the implementation of
@@ -184,7 +184,7 @@ describe 'ActiveRelation', 'A proposed refactoring to ActiveRecord, introducing
end
class Person < ActiveRecord::Base
- set_relation @accounts.join(@profiles).on(@accounts[:id] == @profiles[:account_id])
+ set_relation @accounts.join(@profiles).on(@accounts[:id].equals(@profiles[:account_id]))
end
# I know this sounds crazy, but even writes are possible in the last example.
# calling #save on a person can write to two tables!
diff --git a/spec/active_relation/relations/attribute_spec.rb b/spec/active_relation/relations/attribute_spec.rb
index 0c79e13b93..28fb0c3754 100644
--- a/spec/active_relation/relations/attribute_spec.rb
+++ b/spec/active_relation/relations/attribute_spec.rb
@@ -24,11 +24,11 @@ describe ActiveRelation::Primitives::Attribute do
end
end
- describe '#eql?' do
+ describe '==' do
it "obtains if the relation and attribute name are identical" do
- ActiveRelation::Primitives::Attribute.new(@relation1, :name).should be_eql(ActiveRelation::Primitives::Attribute.new(@relation1, :name))
- ActiveRelation::Primitives::Attribute.new(@relation1, :name).should_not be_eql(ActiveRelation::Primitives::Attribute.new(@relation1, :another_name))
- ActiveRelation::Primitives::Attribute.new(@relation1, :name).should_not be_eql(ActiveRelation::Primitives::Attribute.new(@relation2, :name))
+ ActiveRelation::Primitives::Attribute.new(@relation1, :name).should == ActiveRelation::Primitives::Attribute.new(@relation1, :name)
+ ActiveRelation::Primitives::Attribute.new(@relation1, :name).should_not == ActiveRelation::Primitives::Attribute.new(@relation1, :another_name)
+ ActiveRelation::Primitives::Attribute.new(@relation1, :name).should_not == ActiveRelation::Primitives::Attribute.new(@relation2, :name)
end
end
@@ -38,39 +38,39 @@ describe ActiveRelation::Primitives::Attribute do
@attribute2 = ActiveRelation::Primitives::Attribute.new(@relation2, :name)
end
- describe '==' do
+ describe '#equals' do
it "manufactures an equality predicate" do
- (@attribute1 == @attribute2).should == ActiveRelation::Predicates::Equality.new(@attribute1, @attribute2)
+ @attribute1.equals(@attribute2).should == ActiveRelation::Predicates::Equality.new(@attribute1, @attribute2)
end
end
- describe '<' do
+ describe '#less_than' do
it "manufactures a less-than predicate" do
- (@attribute1 < @attribute2).should == ActiveRelation::Predicates::LessThan.new(@attribute1, @attribute2)
+ @attribute1.less_than(@attribute2).should == ActiveRelation::Predicates::LessThan.new(@attribute1, @attribute2)
end
end
- describe '<=' do
+ describe '#less_than_or_equal_to' do
it "manufactures a less-than or equal-to predicate" do
- (@attribute1 <= @attribute2).should == ActiveRelation::Predicates::LessThanOrEqualTo.new(@attribute1, @attribute2)
+ @attribute1.less_than_or_equal_to(@attribute2).should == ActiveRelation::Predicates::LessThanOrEqualTo.new(@attribute1, @attribute2)
end
end
- describe '>' do
+ describe 'greater_than' do
it "manufactures a greater-than predicate" do
- (@attribute1 > @attribute2).should == ActiveRelation::Predicates::GreaterThan.new(@attribute1, @attribute2)
+ @attribute1.greater_than(@attribute2).should == ActiveRelation::Predicates::GreaterThan.new(@attribute1, @attribute2)
end
end
- describe '>=' do
+ describe '#greater_than_or_equal_to' do
it "manufactures a greater-than or equal to predicate" do
- (@attribute1 >= @attribute2).should == ActiveRelation::Predicates::GreaterThanOrEqualTo.new(@attribute1, @attribute2)
+ @attribute1.greater_than_or_equal_to(@attribute2).should == ActiveRelation::Predicates::GreaterThanOrEqualTo.new(@attribute1, @attribute2)
end
end
- describe '=~' do
+ describe '#matches' do
it "manufactures a match predicate" do
- (@attribute1 =~ /.*/).should == ActiveRelation::Predicates::Match.new(@attribute1, @attribute2)
+ @attribute1.matches(/.*/).should == ActiveRelation::Predicates::Match.new(@attribute1, @attribute2)
end
end
end