active_record_sorting 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84f596dad462acbea2df207029d6141362a77415
|
4
|
+
data.tar.gz: d4b047c510f568b6d3e15446005fda22d2156e6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19e28b6a9d37b4c9f73a3630d5fca53bb56cc93dbc954b1ff31d840ebc584885749ea1508266047967aa75dbcdc1998cfdb01c8d38ebd53b82c734afa6cba84c
|
7
|
+
data.tar.gz: e86ab3ee732a632f7f4eadb9db4837821d78eea57e7d81d15ed24961de355d840376189c993da662397d9b9f08ac20751e50d9368b295274032ed76705455f69
|
@@ -6,8 +6,8 @@ module ActiveRecordSorting
|
|
6
6
|
|
7
7
|
included do
|
8
8
|
def self.sort(order)
|
9
|
-
klass = "#{self
|
10
|
-
klass.new(
|
9
|
+
klass = "#{self}Sorting".constantize rescue ActiveRecordSorting::Base
|
10
|
+
klass.new(where(nil)).sort(order)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -21,6 +21,15 @@ describe ActiveRecordSorting::Concern do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
context 'use scopes' do
|
25
|
+
subject { Group.where(name: 'Lorem') }
|
26
|
+
let(:sorting_class) { ActiveRecordSorting::Base }
|
27
|
+
|
28
|
+
it 'should delegate sorting to base sorting class' do
|
29
|
+
expected_to_sort_with 'name_asc', sorting_class
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
24
33
|
private
|
25
34
|
|
26
35
|
def expected_to_sort_with(order, sorting_class)
|