aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2009-05-17 18:21:56 -0400
committerBryan Helmkamp <bryan@brynary.com>2009-05-17 18:21:56 -0400
commit10c4b42c35f61145ac6ebb8d36f504344eef47cd (patch)
tree3caee2c32a6fbcd0fad4c11ad9235d96670f7ffc /spec
parentc106c1ef59527331c9945f5f95e6b4e27194ac06 (diff)
downloadrails-10c4b42c35f61145ac6ebb8d36f504344eef47cd.tar.gz
rails-10c4b42c35f61145ac6ebb8d36f504344eef47cd.tar.bz2
rails-10c4b42c35f61145ac6ebb8d36f504344eef47cd.zip
Fix bug in Order equality where Descending.new(attribute) was == Ascending.new(attribute)
Diffstat (limited to 'spec')
-rw-r--r--spec/arel/algebra/unit/primitives/attribute_spec.rb4
-rw-r--r--spec/arel/algebra/unit/relations/order_spec.rb10
2 files changed, 12 insertions, 2 deletions
diff --git a/spec/arel/algebra/unit/primitives/attribute_spec.rb b/spec/arel/algebra/unit/primitives/attribute_spec.rb
index afcf1237e0..2ca63ba48e 100644
--- a/spec/arel/algebra/unit/primitives/attribute_spec.rb
+++ b/spec/arel/algebra/unit/primitives/attribute_spec.rb
@@ -169,13 +169,13 @@ module Arel
describe Attribute::Orderings do
describe '#asc' do
it 'manufactures an ascending ordering' do
- pending
+ @attribute.asc.should == Ascending.new(@attribute)
end
end
describe '#desc' do
it 'manufactures a descending ordering' do
- pending
+ @attribute.desc.should == Descending.new(@attribute)
end
end
end
diff --git a/spec/arel/algebra/unit/relations/order_spec.rb b/spec/arel/algebra/unit/relations/order_spec.rb
index 4f163894c8..8b3c932fb9 100644
--- a/spec/arel/algebra/unit/relations/order_spec.rb
+++ b/spec/arel/algebra/unit/relations/order_spec.rb
@@ -6,6 +6,16 @@ module Arel
@relation = Table.new(:users)
@attribute = @relation[:id]
end
+
+ describe "#==" do
+ it "returns true when the Orders are for the same attribute and direction" do
+ Ascending.new(@attribute).should == Ascending.new(@attribute)
+ end
+
+ it "returns false when the Orders are for a diferent direction" do
+ Ascending.new(@attribute).should_not == Descending.new(@attribute)
+ end
+ end
end
end