Permalink
Browse files

Fix sort key mappings. Closes #38.

  • Loading branch information...
1 parent 7147e5c commit ba4e60ef643aed429b870646eb11e20939520027 @cheald cheald committed Jul 11, 2013
Showing with 7 additions and 2 deletions.
  1. +1 −1 lib/plucky/normalizers/options_hash_value.rb
  2. +6 −1 spec/functional/options_hash_spec.rb
@@ -66,7 +66,7 @@ def default_fields_value_normalizer
# Private
def default_sort_value_normalizer
- Normalizers::SortValue.new(:key_normalizer => Normalizers::HashKey.new({:_id => :id}))
+ Normalizers::SortValue.new(:key_normalizer => Normalizers::HashKey.new({:id => :_id}))
end
# Private
@@ -10,6 +10,11 @@
subject[:order].should be_nil
end
+ it "changes sort(id) to sort(_id)" do
+ subject[:sort] = "id asc"
+ subject[:sort].should == [["_id", 1]]
+ end
+
it "changes select to fields" do
subject[:select] = [:foo]
subject[:fields].should == [:foo]
@@ -33,4 +38,4 @@
subject[:sort].should == [["order", 1]]
end
end
-end
+end

0 comments on commit ba4e60e

Please sign in to comment.