search_magic 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -34,7 +34,7 @@ module SearchMagic
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def arrange(arrangeable, direction = :asc)
|
37
|
-
arrangeable.blank? || !searchables.keys.include?(arrangeable) ? criteria : order_by(["arrangeable_values.#{arrangeable}", direction])
|
37
|
+
arrangeable.blank? || !searchables.keys.include?(arrangeable) ? criteria : order_by([["arrangeable_values.#{arrangeable}", direction]])
|
38
38
|
end
|
39
39
|
|
40
40
|
private
|
data/lib/search_magic/version.rb
CHANGED
@@ -61,7 +61,13 @@ describe SearchMagic::FullTextSearch do
|
|
61
61
|
subject { Asset.arrange(:title) }
|
62
62
|
it { should be_a(Mongoid::Criteria) }
|
63
63
|
its(:options) { should_not be_empty }
|
64
|
-
its(:options) { should include(:sort => ["arrangeable_values.title", :asc]) }
|
64
|
+
its(:options) { should include(:sort => [["arrangeable_values.title", :asc]]) }
|
65
|
+
end
|
66
|
+
|
67
|
+
context "when arranging a model on multiple searchables" do
|
68
|
+
subject { Asset.arrange(:title).arrange(:tag) }
|
69
|
+
it { should be_a(Mongoid::Criteria) }
|
70
|
+
its(:options) { should include(:sort => [["arrangeable_values.title", :asc], ["arrangeable_values.tag", :asc]]) }
|
65
71
|
end
|
66
72
|
|
67
73
|
shared_examples_for "arranged assets" do |arrangeable, direction, expected_order|
|