searchlogic 2.5.10 → 2.5.11

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
- searchlogic (2.5.9)
4
+ searchlogic (2.5.10)
5
5
  activerecord (~> 2.3.12)
6
6
  activesupport (~> 2.3.12)
7
7
 
@@ -3,11 +3,11 @@ module Searchlogic
3
3
  module Ordering
4
4
  # Returns the column we are currently ordering by
5
5
  def ordering_by
6
- @ordering_by ||= order && order.to_s.gsub(/^(ascend|descend)_by_/, '')
6
+ @ordering_by ||= order && order.to_s.match(/^(ascend|descend)_by_(.*)$/).try(:[], 2)
7
7
  end
8
8
 
9
9
  def ordering_direction
10
- @ordering_direction ||= order && order.to_s.match(/^(ascend|descend)_by_ass/).try(:[], 1)
10
+ @ordering_direction ||= order && order.to_s.match(/^(ascend|descend)_by_/).try(:[], 1)
11
11
  end
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module Searchlogic
2
- VERSION = "2.5.10"
2
+ VERSION = "2.5.11"
3
3
  end
@@ -5,12 +5,12 @@ describe Searchlogic::NamedScopes::Ordering do
5
5
  %w(bjohnson thunt).each { |username| User.create(:username => username) }
6
6
  User.ascend_by_username.all.should == User.all(:order => "username ASC")
7
7
  end
8
-
8
+
9
9
  it "should have descending" do
10
10
  %w(bjohnson thunt).each { |username| User.create(:username => username) }
11
11
  User.descend_by_username.all.should == User.all(:order => "username DESC")
12
12
  end
13
-
13
+
14
14
  it "should have order" do
15
15
  User.order("ascend_by_username").proxy_options.should == User.ascend_by_username.proxy_options
16
16
  end
@@ -21,7 +21,7 @@ describe Searchlogic::NamedScopes::Ordering do
21
21
  User.named_scope(:ascend_by_custom, :order => "username ASC, name DESC")
22
22
  User.order("ascend_by_custom").proxy_options.should == User.ascend_by_custom.proxy_options
23
23
  end
24
-
24
+
25
25
  it "should have priorty to columns over conflicting association columns" do
26
26
  Company.ascend_by_users_count
27
27
  end
@@ -372,6 +372,23 @@ describe Searchlogic::Search do
372
372
  end
373
373
  end
374
374
 
375
+ context "#ordering_direction" do
376
+ it "should return nil if we aren't ordering" do
377
+ search = User.search
378
+ search.ordering_direction.should be_nil
379
+ end
380
+
381
+ it "should return the column name for ascending" do
382
+ search = User.search(:order => "ascend_by_ticket_request_event_occurs_at")
383
+ search.ordering_direction.should == "ascend"
384
+ end
385
+
386
+ it "should return the column name for descending" do
387
+ search = User.search(:order => "descend_by_ticket_request_event_occurs_at")
388
+ search.ordering_direction.should == "descend"
389
+ end
390
+ end
391
+
375
392
  context "#method_missing" do
376
393
  context "setting" do
377
394
  it "should call named scopes for conditions" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.10
4
+ version: 2.5.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: