aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/algebra/unit/primitives
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2009-05-17 16:20:40 -0400
committerBryan Helmkamp <bryan@brynary.com>2009-05-17 16:20:40 -0400
commitdc7b51883b1cc8ad7e525b7315fb575ae77a5b3d (patch)
tree97f5e4d55baa45f9805eb36a2196bcc12094ae3a /spec/arel/algebra/unit/primitives
parent19b2af181009acfcb24d156ca350c148630e6787 (diff)
downloadrails-dc7b51883b1cc8ad7e525b7315fb575ae77a5b3d.tar.gz
rails-dc7b51883b1cc8ad7e525b7315fb575ae77a5b3d.tar.bz2
rails-dc7b51883b1cc8ad7e525b7315fb575ae77a5b3d.zip
Whitespace
Diffstat (limited to 'spec/arel/algebra/unit/primitives')
-rw-r--r--spec/arel/algebra/unit/primitives/attribute_spec.rb58
-rw-r--r--spec/arel/algebra/unit/primitives/expression_spec.rb12
-rw-r--r--spec/arel/algebra/unit/primitives/value_spec.rb2
3 files changed, 36 insertions, 36 deletions
diff --git a/spec/arel/algebra/unit/primitives/attribute_spec.rb b/spec/arel/algebra/unit/primitives/attribute_spec.rb
index dcac5abf65..89e338e377 100644
--- a/spec/arel/algebra/unit/primitives/attribute_spec.rb
+++ b/spec/arel/algebra/unit/primitives/attribute_spec.rb
@@ -6,32 +6,32 @@ module Arel
@relation = Table.new(:users)
@attribute = @relation[:id]
end
-
+
describe Attribute::Transformations do
describe '#as' do
it "manufactures an aliased attributed" do
@attribute.as(:alias).should == Attribute.new(@relation, @attribute.name, :alias => :alias, :ancestor => @attribute)
end
end
-
+
describe '#bind' do
it "manufactures an attribute with the relation bound and self as an ancestor" do
derived_relation = @relation.where(@relation[:id].eq(1))
@attribute.bind(derived_relation).should == Attribute.new(derived_relation, @attribute.name, :ancestor => @attribute)
end
-
+
it "returns self if the substituting to the same relation" do
@attribute.bind(@relation).should == @attribute
end
end
-
+
describe '#to_attribute' do
describe 'when the given relation is the same as the attributes relation' do
it "returns self" do
@attribute.to_attribute(@relation).should == @attribute
end
end
-
+
describe 'when the given relation differs from the attributes relation' do
it 'binds to the new relation' do
@attribute.to_attribute(new_relation = @relation.alias).should == @attribute.bind(new_relation)
@@ -39,32 +39,32 @@ module Arel
end
end
end
-
+
describe '#column' do
it "returns the corresponding column in the relation" do
@attribute.column.should == @relation.column_for(@attribute)
end
end
-
+
describe '#engine' do
it "delegates to its relation" do
Attribute.new(@relation, :id).engine.should == @relation.engine
end
end
-
+
describe Attribute::Congruence do
describe '/' do
before do
@aliased_relation = @relation.alias
@doubly_aliased_relation = @aliased_relation.alias
end
-
+
describe 'when dividing two unrelated attributes' do
it "returns 0.0" do
(@relation[:id] / @relation[:name]).should == 0.0
end
end
-
+
describe 'when dividing two matching attributes' do
it 'returns a the highest score for the most similar attributes' do
(@aliased_relation[:id] / @relation[:id]) \
@@ -75,98 +75,98 @@ module Arel
end
end
end
-
+
describe Attribute::Predications do
before do
@attribute = Attribute.new(@relation, :name)
end
-
+
describe '#eq' do
it "manufactures an equality predicate" do
@attribute.eq('name').should == Equality.new(@attribute, 'name')
end
end
-
+
describe '#lt' do
it "manufactures a less-than predicate" do
@attribute.lt(10).should == LessThan.new(@attribute, 10)
end
end
-
+
describe '#lteq' do
it "manufactures a less-than or equal-to predicate" do
@attribute.lteq(10).should == LessThanOrEqualTo.new(@attribute, 10)
end
end
-
+
describe '#gt' do
it "manufactures a greater-than predicate" do
@attribute.gt(10).should == GreaterThan.new(@attribute, 10)
end
end
-
+
describe '#gteq' do
it "manufactures a greater-than or equal-to predicate" do
@attribute.gteq(10).should == GreaterThanOrEqualTo.new(@attribute, 10)
end
end
-
+
describe '#matches' do
it "manufactures a match predicate" do
@attribute.matches(/.*/).should == Match.new(@attribute, /.*/)
end
end
-
+
describe '#in' do
it "manufactures an in predicate" do
@attribute.in(1..30).should == In.new(@attribute, (1..30))
end
end
end
-
+
describe Attribute::Expressions do
before do
- @attribute = Attribute.new(@relation, :name)
+ @attribute = Attribute.new(@relation, :name)
end
-
+
describe '#count' do
it "manufactures a count Expression" do
@attribute.count.should == Count.new(@attribute)
end
end
-
+
describe '#sum' do
it "manufactures a sum Expression" do
@attribute.sum.should == Sum.new(@attribute)
end
end
-
+
describe '#maximum' do
it "manufactures a maximum Expression" do
@attribute.maximum.should == Maximum.new(@attribute)
end
end
-
+
describe '#minimum' do
it "manufactures a minimum Expression" do
@attribute.minimum.should == Minimum.new(@attribute)
end
end
-
+
describe '#average' do
it "manufactures an average Expression" do
@attribute.average.should == Average.new(@attribute)
end
- end
+ end
end
-
+
describe Attribute::Orderings do
describe '#asc' do
it 'manufactures an ascending ordering' do
pending
end
end
-
+
describe '#desc' do
it 'manufactures a descending ordering' do
pending
@@ -174,4 +174,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/primitives/expression_spec.rb b/spec/arel/algebra/unit/primitives/expression_spec.rb
index dfd2100048..82d12d53f9 100644
--- a/spec/arel/algebra/unit/primitives/expression_spec.rb
+++ b/spec/arel/algebra/unit/primitives/expression_spec.rb
@@ -6,29 +6,29 @@ module Arel
@relation = Table.new(:users)
@attribute = @relation[:id]
end
-
+
describe Expression::Transformations do
before do
@expression = Count.new(@attribute)
end
-
+
describe '#bind' do
it "manufactures an attribute with a rebound relation and self as the ancestor" do
derived_relation = @relation.where(@relation[:id].eq(1))
@expression.bind(derived_relation).should == Count.new(@attribute.bind(derived_relation), nil, @expression)
end
-
+
it "returns self if the substituting to the same relation" do
@expression.bind(@relation).should == @expression
end
end
-
+
describe '#as' do
it "manufactures an aliased expression" do
@expression.as(:alias).should == Expression.new(@attribute, :alias, @expression)
end
end
-
+
describe '#to_attribute' do
it "manufactures an attribute with the expression as an ancestor" do
@expression.to_attribute(@relation).should == Attribute.new(@relation, @expression.alias, :ancestor => @expression)
@@ -36,4 +36,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/primitives/value_spec.rb b/spec/arel/algebra/unit/primitives/value_spec.rb
index 8774ca78c5..45208e6c5d 100644
--- a/spec/arel/algebra/unit/primitives/value_spec.rb
+++ b/spec/arel/algebra/unit/primitives/value_spec.rb
@@ -12,4 +12,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end