search_magic 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- search_magic (0.0.4)
4
+ search_magic (0.0.5)
5
5
  mongoid (>= 2.0.0.rc.7)
6
6
 
7
7
  GEM
@@ -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.to_sym) ? criteria : order_by([["arrangeable_values.#{arrangeable}", direction]])
38
38
  end
39
39
 
40
40
  private
@@ -1,3 +1,3 @@
1
1
  module SearchMagic
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -64,6 +64,13 @@ describe SearchMagic::FullTextSearch do
64
64
  its(:options) { should include(:sort => [["arrangeable_values.title", :asc]]) }
65
65
  end
66
66
 
67
+ context "when arranging a model by a searchable.to_s" do
68
+ subject { Asset.arrange("title") }
69
+ it { should be_a(Mongoid::Criteria) }
70
+ its(:options) { should_not be_empty }
71
+ its(:options) { should include(:sort => [["arrangeable_values.title", :asc]]) }
72
+ end
73
+
67
74
  context "when arranging a model on multiple searchables" do
68
75
  subject { Asset.arrange(:title).arrange(:tag) }
69
76
  it { should be_a(Mongoid::Criteria) }
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 6
9
+ version: 0.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joshua Bowers