assorted 0.0.1 → 0.0.2

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: 91e2d41bfce1a1dc7df96c83a9b5d5baa6fc939f
4
- data.tar.gz: 71b2621335edd05c40d5ddd7c7c5ab96760aa916
3
+ metadata.gz: 7c1b25bd61cd38f3d4f8bca37962bdcf283c833c
4
+ data.tar.gz: cc009513f6595ba60033fefda3d7b623186adbfd
5
5
  SHA512:
6
- metadata.gz: 90c0b02d1554a2ca14b35f82eb329dcc6af33672c31e93616406546dfaefcb9a5bfec7b692c64e54b364131a594243ffbc4f24b263825eac7e616349acec3047
7
- data.tar.gz: a213cf2f5f0ce389298e54daef8f47ffe5f2433f6eddd1cf49e325f213fbc7e5b71a53b1af3609b4363a3b5faa4abbd956e897c2805d5396baa66197c65f3fec
6
+ metadata.gz: 81f2402794924d399d317d5ad99331e527648c083a64cdc70a13d231e7710f70bc51f6d37feca7aab5acc385621a070a0711511945745918d8a6a0e852cc618d
7
+ data.tar.gz: 7eda1d0e7e2169655a90d79d173c5f8aa41595653c957a3f2766eb22bdde8b803860b9e40459cf0888e8706c7c190be9c23af820390b0fbe8236105c5edf591b
@@ -8,12 +8,8 @@ module Assorted
8
8
  sanitized_order(column, :desc)
9
9
  end
10
10
 
11
- def sorting_column
12
- @sorting_column ||= :created_at
13
- end
14
-
15
- def sorting_column=(column)
16
- @sorting_column = column
11
+ def set_sorting_column(column)
12
+ self.sorting_column = column
17
13
  end
18
14
 
19
15
  private
@@ -25,5 +21,14 @@ module Assorted
25
21
  raise ActiveRecord::StatementInvalid, "Unknown column #{column}"
26
22
  end
27
23
  end
24
+
25
+ def sorting_column
26
+ @sorting_column ||= :created_at
27
+ end
28
+
29
+ def sorting_column=(column)
30
+ @sorting_column = column
31
+ end
32
+
28
33
  end
29
34
  end
@@ -1,3 +1,3 @@
1
1
  module Assorted
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -29,7 +29,9 @@ RSpec.describe Assorted::Scopes do
29
29
  more = ExampleRecord.create(example_count: 2)
30
30
  less = ExampleRecord.create(example_count: 1)
31
31
 
32
- ExampleRecord.sorting_column = :example_count
32
+ class ExampleRecord
33
+ set_sorting_column :example_count
34
+ end
33
35
 
34
36
  expect(ExampleRecord.asc).to eq([less, more])
35
37
  expect(ExampleRecord.desc).to eq([more, less])
@@ -13,11 +13,11 @@ RSpec.configure do |config|
13
13
  table.timestamps
14
14
  end
15
15
 
16
- original_sorting_column = ExampleRecord.sorting_column
16
+ original_sorting_column = ExampleRecord.send(:sorting_column)
17
17
 
18
18
  example.run
19
19
 
20
- ExampleRecord.sorting_column = original_sorting_column
20
+ ExampleRecord.send(:sorting_column=, original_sorting_column)
21
21
 
22
22
  raise ActiveRecord::Rollback
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assorted
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Byrne