filterable-by 0.5.1 → 0.5.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
  SHA256:
3
- metadata.gz: ae571004dd8c2aebddad1f69b8a698b7f52f0fa5bb2d3338a74de5f6a9e18e1a
4
- data.tar.gz: f1744d312f8b99eab4ada84590b65361e1cb183ef3a41ce1969569ca723880e5
3
+ metadata.gz: 8a45bdeb246550581221e6a721af41f27e355b9d87d1fd8dd791731142bba9cd
4
+ data.tar.gz: 06f4640997ef9fbfc88b6cedb943cf0840c0e643c7012ffd441700e52495113e
5
5
  SHA512:
6
- metadata.gz: ce8c6eabe14c36dd917c8f30f29926a6ae88baa494067683912f63dd3af6445ca93b74426e1d24c3f8992e2d740d340a4bbb8b494c033872fb1a0ed51924e085
7
- data.tar.gz: eed08234ac28e40f99fc786225bc2e65ead127808e93714d8747a30fcb0c4a01fe27b450f4dfa9de713d08d05cd1c65c2e6c4412402a0567b48d5f05a1b1011b
6
+ metadata.gz: c292090ad77af10f1729f4ad652fb84595fe20d866bf4ab221d642465fc56fa4073dc7cc2ed2469b9a92169e418f2860f44ea4702bbf4cbf34e1591b07645077
7
+ data.tar.gz: '08a1ec2870b5da50e5b41b35a06e8adf5b72f375c50fb2bc3009d9a4c17f5140b4f44f44ffc764aa8f73703a9f041610b37075ebbedabfd84db362690562b9a2'
@@ -0,0 +1,21 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ ruby-version: ["2.6", "2.7", "3.0"]
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby-version }}
20
+ bundler-cache: true
21
+ - run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,6 +1,11 @@
1
- inherit_from:
2
- - https://gitlab.com/bsm/misc/raw/master/rubocop/default.yml
1
+ inherit_gem:
2
+ rubocop-bsm:
3
+ - default.yml
4
+ inherit_mode:
5
+ merge:
6
+ - Exclude
7
+
3
8
  AllCops:
4
- TargetRubyVersion: "2.5"
9
+ TargetRubyVersion: "2.6"
5
10
  Naming/FileName:
6
11
  Exclude: [lib/filterable-by.rb]
data/Gemfile.lock CHANGED
@@ -1,68 +1,86 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- filterable-by (0.5.1)
4
+ filterable-by (0.5.2)
5
5
  activerecord
6
6
  activesupport
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- activemodel (6.0.3.2)
12
- activesupport (= 6.0.3.2)
13
- activerecord (6.0.3.2)
14
- activemodel (= 6.0.3.2)
15
- activesupport (= 6.0.3.2)
16
- activesupport (6.0.3.2)
11
+ activemodel (6.1.3)
12
+ activesupport (= 6.1.3)
13
+ activerecord (6.1.3)
14
+ activemodel (= 6.1.3)
15
+ activesupport (= 6.1.3)
16
+ activesupport (6.1.3)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- zeitwerk (~> 2.2, >= 2.2.2)
22
- ast (2.4.1)
23
- concurrent-ruby (1.1.6)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ zeitwerk (~> 2.3)
22
+ ast (2.4.2)
23
+ concurrent-ruby (1.1.8)
24
24
  diff-lcs (1.4.4)
25
- i18n (1.8.3)
25
+ i18n (1.8.9)
26
26
  concurrent-ruby (~> 1.0)
27
- minitest (5.14.1)
28
- parallel (1.19.2)
29
- parser (2.7.1.4)
27
+ minitest (5.14.4)
28
+ parallel (1.20.1)
29
+ parser (3.0.0.0)
30
30
  ast (~> 2.4.1)
31
+ rack (2.2.3)
31
32
  rainbow (3.0.0)
32
- rake (13.0.1)
33
- regexp_parser (1.7.1)
33
+ rake (13.0.3)
34
+ regexp_parser (2.1.1)
34
35
  rexml (3.2.4)
35
- rspec (3.9.0)
36
- rspec-core (~> 3.9.0)
37
- rspec-expectations (~> 3.9.0)
38
- rspec-mocks (~> 3.9.0)
39
- rspec-core (3.9.2)
40
- rspec-support (~> 3.9.3)
41
- rspec-expectations (3.9.2)
36
+ rspec (3.10.0)
37
+ rspec-core (~> 3.10.0)
38
+ rspec-expectations (~> 3.10.0)
39
+ rspec-mocks (~> 3.10.0)
40
+ rspec-core (3.10.1)
41
+ rspec-support (~> 3.10.0)
42
+ rspec-expectations (3.10.1)
42
43
  diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.9.0)
44
- rspec-mocks (3.9.1)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-mocks (3.10.2)
45
46
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.9.0)
47
- rspec-support (3.9.3)
48
- rubocop (0.87.1)
47
+ rspec-support (~> 3.10.0)
48
+ rspec-support (3.10.2)
49
+ rubocop (1.11.0)
49
50
  parallel (~> 1.10)
50
- parser (>= 2.7.1.1)
51
+ parser (>= 3.0.0.0)
51
52
  rainbow (>= 2.2.2, < 4.0)
52
- regexp_parser (>= 1.7)
53
+ regexp_parser (>= 1.8, < 3.0)
53
54
  rexml
54
- rubocop-ast (>= 0.1.0, < 1.0)
55
+ rubocop-ast (>= 1.2.0, < 2.0)
55
56
  ruby-progressbar (~> 1.7)
56
- unicode-display_width (>= 1.4.0, < 2.0)
57
- rubocop-ast (0.1.0)
58
- parser (>= 2.7.0.1)
59
- ruby-progressbar (1.10.1)
57
+ unicode-display_width (>= 1.4.0, < 3.0)
58
+ rubocop-ast (1.4.1)
59
+ parser (>= 2.7.1.5)
60
+ rubocop-bsm (0.5.4)
61
+ rubocop (~> 1.0)
62
+ rubocop-performance
63
+ rubocop-rails
64
+ rubocop-rake
65
+ rubocop-rspec
66
+ rubocop-performance (1.10.1)
67
+ rubocop (>= 0.90.0, < 2.0)
68
+ rubocop-ast (>= 0.4.0)
69
+ rubocop-rails (2.9.1)
70
+ activesupport (>= 4.2.0)
71
+ rack (>= 1.1)
72
+ rubocop (>= 0.90.0, < 2.0)
73
+ rubocop-rake (0.5.1)
74
+ rubocop
75
+ rubocop-rspec (2.2.0)
76
+ rubocop (~> 1.0)
77
+ rubocop-ast (>= 1.1.0)
78
+ ruby-progressbar (1.11.0)
60
79
  sqlite3 (1.4.2)
61
- thread_safe (0.3.6)
62
- tzinfo (1.2.7)
63
- thread_safe (~> 0.1)
64
- unicode-display_width (1.7.0)
65
- zeitwerk (2.3.1)
80
+ tzinfo (2.0.4)
81
+ concurrent-ruby (~> 1.0)
82
+ unicode-display_width (2.0.0)
83
+ zeitwerk (2.4.2)
66
84
 
67
85
  PLATFORMS
68
86
  ruby
@@ -72,7 +90,7 @@ DEPENDENCIES
72
90
  filterable-by!
73
91
  rake
74
92
  rspec
75
- rubocop
93
+ rubocop-bsm
76
94
  sqlite3
77
95
 
78
96
  BUNDLED WITH
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'filterable-by'
3
- s.version = '0.5.1'
3
+ s.version = '0.5.2'
4
4
  s.authors = ['Dimitrij Denissenko']
5
5
  s.email = ['dimitrij@blacksquaremedia.com']
6
6
  s.summary = 'Generate white-listed filter scopes from URL parameter values'
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^spec/}) }
12
12
  s.test_files = `git ls-files -z -- spec/*`.split("\x0")
13
13
  s.require_paths = ['lib']
14
- s.required_ruby_version = '>= 2.5'
14
+ s.required_ruby_version = '>= 2.6'
15
15
 
16
16
  s.add_dependency 'activerecord'
17
17
  s.add_dependency 'activesupport'
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.add_development_dependency 'bundler'
20
20
  s.add_development_dependency 'rake'
21
21
  s.add_development_dependency 'rspec'
22
- s.add_development_dependency 'rubocop'
22
+ s.add_development_dependency 'rubocop-bsm'
23
23
  s.add_development_dependency 'sqlite3'
24
24
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe ActiveRecord::FilterableBy do
4
4
  let(:alice) { AUTHORS[:alice] }
@@ -7,13 +7,13 @@ describe ActiveRecord::FilterableBy do
7
7
  let(:apost) { POSTS[:alices] }
8
8
  let(:bpost) { POSTS[:bobs] }
9
9
 
10
- it 'should have config' do
10
+ it 'has config' do
11
11
  expect(Comment.send(:_filterable_by_config).count).to eq(3)
12
12
  expect(Rating.send(:_filterable_by_config).count).to eq(2)
13
13
  expect(Post.send(:_filterable_by_config).count).to eq(2)
14
14
  end
15
15
 
16
- it 'should ignore bad inputs' do
16
+ it 'ignores bad inputs' do
17
17
  expect(Comment.filter_by.count).to eq(4)
18
18
  expect(Comment.filter_by(nil).count).to eq(4)
19
19
  expect(Comment.filter_by(nil, extra: true).count).to eq(4)
@@ -23,7 +23,7 @@ describe ActiveRecord::FilterableBy do
23
23
  expect(Comment.filter_by('author_id' => []).count).to eq(4)
24
24
  end
25
25
 
26
- it 'should generate simple scopes' do
26
+ it 'generates simple scopes' do
27
27
  expect(Comment.filter_by('author_id' => alice.id).pluck(:title)).to match_array(%w[AA AB])
28
28
  expect(Comment.filter_by('author_id' => bob.id).pluck(:title)).to match_array(%w[BA BB])
29
29
  expect(Comment.filter_by('author_id' => [alice.id, '']).pluck(:title)).to match_array(%w[AA AB])
@@ -40,7 +40,7 @@ describe ActiveRecord::FilterableBy do
40
40
  expect(Post.filter_by('author_id' => bob.id).count).to eq(1)
41
41
  end
42
42
 
43
- it 'should generate combined scopes' do
43
+ it 'generates combined scopes' do
44
44
  expect(Comment.filter_by('author_id' => alice.id, 'post_id' => apost.id).pluck(:title)).to match_array(['AA'])
45
45
  expect(Comment.filter_by('author_id' => alice.id, 'post_id' => bpost.id).pluck(:title)).to match_array(['AB'])
46
46
  expect(Comment.filter_by('author_id' => bob.id, 'post_id' => apost.id).pluck(:title)).to match_array(['BA'])
@@ -50,12 +50,12 @@ describe ActiveRecord::FilterableBy do
50
50
  expect(scope.pluck(:title)).to match_array(%w[AB BB])
51
51
  end
52
52
 
53
- it 'should combine with other scopes' do
53
+ it 'combines with other scopes' do
54
54
  scope = Comment.where(author_id: alice.id).filter_by('post_id' => apost.id)
55
55
  expect(scope.pluck(:title)).to match_array(['AA'])
56
56
  end
57
57
 
58
- it 'should allow custom options' do
58
+ it 'allows custom options' do
59
59
  scope = Post.filter_by({ 'only' => 'me' }, user_id: alice.id)
60
60
  expect(scope).to match_array([apost])
61
61
 
@@ -66,13 +66,13 @@ describe ActiveRecord::FilterableBy do
66
66
  expect(scope.count).to eq(0)
67
67
  end
68
68
 
69
- it 'should allow custom options from params' do
69
+ it 'allows custom options from params' do
70
70
  filter = { 'only' => 'me' }
71
71
  expect(Post.filter_by(filter, user_id: alice.id)).to match_array([apost])
72
72
  expect(Post.filter_by(filter).count).to eq(0)
73
73
  end
74
74
 
75
- it 'should ignore invalid scopes' do
75
+ it 'ignores invalid scopes' do
76
76
  expect(Comment.filter_by('invalid' => 1).count).to eq(4)
77
77
  expect(Post.filter_by('post_id' => bpost.id).count).to eq(2)
78
78
  expect(Rating.filter_by('post_author_id' => bob.id).count).to eq(1)
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,7 @@ ActiveRecord::Base.establish_connection :test
7
7
 
8
8
  ActiveRecord::Base.connection.instance_eval do
9
9
  create_table :authors do |_|
10
+ # no columns
10
11
  end
11
12
  create_table :posts do |t|
12
13
  t.integer :author_id, null: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filterable-by
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-13 00:00:00.000000000 Z
11
+ date: 2021-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rubocop
84
+ name: rubocop-bsm
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -115,9 +115,9 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
+ - ".github/workflows/ruby.yml"
118
119
  - ".gitignore"
119
120
  - ".rubocop.yml"
120
- - ".travis.yml"
121
121
  - Gemfile
122
122
  - Gemfile.lock
123
123
  - LICENSE
@@ -126,7 +126,7 @@ files:
126
126
  - filterable-by.gemspec
127
127
  - lib/filterable-by.rb
128
128
  - lib/filterable_by.rb
129
- - spec/filterable_by_spec.rb
129
+ - spec/active_record/filterable_by_spec.rb
130
130
  - spec/spec_helper.rb
131
131
  homepage: https://github.com/bsm/filterable-by
132
132
  licenses:
@@ -140,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
140
  requirements:
141
141
  - - ">="
142
142
  - !ruby/object:Gem::Version
143
- version: '2.5'
143
+ version: '2.6'
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
146
  - - ">="
@@ -152,5 +152,5 @@ signing_key:
152
152
  specification_version: 4
153
153
  summary: Generate white-listed filter scopes from URL parameter values
154
154
  test_files:
155
- - spec/filterable_by_spec.rb
155
+ - spec/active_record/filterable_by_spec.rb
156
156
  - spec/spec_helper.rb
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- rvm:
2
- - 2.5
3
- - 2.6
4
- - 2.7
5
- gemfile:
6
- - Gemfile