aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/engines/memory/unit/relations/order_spec.rb
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2009-05-17 15:44:03 -0400
committerBryan Helmkamp <bryan@brynary.com>2009-05-17 15:44:03 -0400
commitb7f58db57a535806e0cfc3057fbab80ca43b1a53 (patch)
tree987ef15b24bbb0cab7edd43c61618fbf46ce02fa /spec/arel/engines/memory/unit/relations/order_spec.rb
parent8339f024c7663133a78c4d0a8824b5b6fafaf239 (diff)
downloadrails-b7f58db57a535806e0cfc3057fbab80ca43b1a53.tar.gz
rails-b7f58db57a535806e0cfc3057fbab80ca43b1a53.tar.bz2
rails-b7f58db57a535806e0cfc3057fbab80ca43b1a53.zip
better test ordering
Conflicts: doc/TODO
Diffstat (limited to 'spec/arel/engines/memory/unit/relations/order_spec.rb')
-rw-r--r--spec/arel/engines/memory/unit/relations/order_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/arel/engines/memory/unit/relations/order_spec.rb b/spec/arel/engines/memory/unit/relations/order_spec.rb
new file mode 100644
index 0000000000..3ecb31068b
--- /dev/null
+++ b/spec/arel/engines/memory/unit/relations/order_spec.rb
@@ -0,0 +1,27 @@
+require File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..', 'spec_helper')
+
+module Arel
+ describe Order do
+ before do
+ @relation = Array.new([
+ [1, 'duck' ],
+ [2, 'duck' ],
+ [3, 'goose']
+ ], [:id, :name])
+ end
+
+ describe '#call' do
+ it 'sorts the relation with the provided ordering' do
+ @relation \
+ .order(@relation[:id].desc) \
+ .let do |relation|
+ relation.call.should == [
+ Row.new(relation, [3, 'goose']),
+ Row.new(relation, [2, 'duck' ]),
+ Row.new(relation, [1, 'duck' ])
+ ]
+ end
+ end
+ end
+ end
+end \ No newline at end of file