search_cop 1.2.0 → 1.2.1

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: 8cb7e91b305057b2ea3df0c96643f8cd2cc726583f2362db9d576ef128826a75
4
- data.tar.gz: 419ee38ec698795d478f7749486e63b533c9cc497057aa820b5627b343cbdeb4
3
+ metadata.gz: 07623ce75206a9b6b4455141697c09782649b05f1073ec27c965a7a4fdf2862a
4
+ data.tar.gz: 5adef700f6a6514d0d1de0b1f17958d03ecacc0a0f83df57de5aff480bc96da5
5
5
  SHA512:
6
- metadata.gz: 19b765a13b9a21a5b798b60618253729b4a8c1279babe47644d5c030b93b09c87706138ab11cd5bfd9daee757d8d04bff95fc1bc3ce50c5f6f7399aaaabc09d1
7
- data.tar.gz: a65e72e3d6e5500b986bb312c45dbbd00432419b344765c71387432dd127efd5eb463cd42f71c3e405913a66b8d45201b9d909b9e66da17bf28f11ea3b7aa5c8
6
+ metadata.gz: fbe73b6ec59b87263d9bfd7d4740618deab1dd7d4867dcb39a864e75db8614f08beed34518477791dd3d66f10ee8461a1282a3d81d35ee17b2a7de26d8c995cf
7
+ data.tar.gz: c131ea06253e994bc5550570708cc5dc973b5392ca208020de08c3384153492c0bc9820438fc0d32c596ec46f27c9982b445d98b80363a89764b6461a4a35706
@@ -4,10 +4,18 @@ jobs:
4
4
  build:
5
5
  runs-on: ubuntu-latest
6
6
  strategy:
7
+ fail-fast: false
7
8
  matrix:
8
- ruby: ["2.5", "2.6", "2.7"]
9
- rails: ["rails5", "rails6"]
9
+ ruby: ["2.6", "2.7", "3.0", "3.1"]
10
+ rails: ["rails5", "rails6", "rails7"]
10
11
  database: ["sqlite", "postgres", "mysql"]
12
+ exclude:
13
+ - ruby: "3.0"
14
+ rails: "rails5"
15
+ - ruby: "3.1"
16
+ rails: "rails5"
17
+ - ruby: "2.6"
18
+ rails: "rails7"
11
19
  services:
12
20
  postgres:
13
21
  image: postgres
@@ -27,7 +35,7 @@ jobs:
27
35
  - 3306:3306
28
36
  steps:
29
37
  - uses: actions/checkout@v1
30
- - uses: actions/setup-ruby@v1
38
+ - uses: ruby/setup-ruby@v1
31
39
  with:
32
40
  ruby-version: ${{ matrix.ruby }}
33
41
  - name: test
data/.rubocop.yml CHANGED
@@ -1,6 +1,12 @@
1
1
  AllCops:
2
2
  NewCops: enable
3
3
 
4
+ Gemspec/RequireMFA:
5
+ Enabled: false
6
+
7
+ Style/FetchEnvVar:
8
+ Enabled: false
9
+
4
10
  Gemspec/RequiredRubyVersion:
5
11
  Enabled: false
6
12
 
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
 
2
2
  # Changelog
3
3
 
4
+ Version 1.2.1:
5
+
6
+ * Fix use of `table_name` to work with inherited models
7
+ * Fix linter, add ruby 3 and rails 7 to ci pipeline
8
+
4
9
  Version 1.2.0:
5
10
 
6
11
  * Added support for disabling the right wildcard
@@ -0,0 +1,13 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 7.0"
6
+
7
+ platforms :ruby do
8
+ gem "mysql2"
9
+ gem "pg"
10
+ gem "sqlite3"
11
+ end
12
+
13
+ gemspec path: "../"
@@ -12,7 +12,7 @@ module SearchCop
12
12
  end
13
13
 
14
14
  def associations
15
- all_associations - [query_info.model.name.tableize.to_sym]
15
+ all_associations - [query_info.model.table_name.to_sym]
16
16
  end
17
17
 
18
18
  private
@@ -1,3 +1,3 @@
1
1
  module SearchCop
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
data/search_cop.gemspec CHANGED
@@ -14,7 +14,6 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
17
  spec.require_paths = ["lib"]
19
18
 
20
19
  spec.add_dependency "treetop"
@@ -61,6 +61,15 @@ class SearchCopTest < SearchCop::TestCase
61
61
  refute_includes results, rejected
62
62
  end
63
63
 
64
+ def test_inherited_model
65
+ expected = create(:available_product, comments: [create(:comment, user: create(:user, username: "Expected"))])
66
+ rejected = create(:available_product, comments: [create(:comment, user: create(:user, username: "Rejected"))])
67
+
68
+ results = AvailableProduct.search("user: Expected")
69
+ assert_includes results, expected
70
+ refute_includes results, rejected
71
+ end
72
+
64
73
  def test_multiple
65
74
  product = create(:product, comments: [create(:comment, title: "Title", message: "Message")])
66
75
 
data/test/test_helper.rb CHANGED
@@ -77,10 +77,18 @@ class Product < ActiveRecord::Base
77
77
  belongs_to :user
78
78
  end
79
79
 
80
+ class AvailableProduct < Product
81
+ default_scope { where(available: true) }
82
+ end
83
+
80
84
  FactoryBot.define do
81
85
  factory :product do
82
86
  end
83
87
 
88
+ factory :available_product do
89
+ available { true }
90
+ end
91
+
84
92
  factory :comment do
85
93
  end
86
94
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_cop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Vetter
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-13 00:00:00.000000000 Z
11
+ date: 2022-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop
@@ -128,6 +128,7 @@ files:
128
128
  - docker-compose.yml
129
129
  - gemfiles/rails5.gemfile
130
130
  - gemfiles/rails6.gemfile
131
+ - gemfiles/rails7.gemfile
131
132
  - lib/search_cop.rb
132
133
  - lib/search_cop/grammar_parser.rb
133
134
  - lib/search_cop/hash_parser.rb
@@ -167,7 +168,7 @@ homepage: https://github.com/mrkamel/search_cop
167
168
  licenses:
168
169
  - MIT
169
170
  metadata: {}
170
- post_install_message:
171
+ post_install_message:
171
172
  rdoc_options: []
172
173
  require_paths:
173
174
  - lib
@@ -182,27 +183,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
183
  - !ruby/object:Gem::Version
183
184
  version: '0'
184
185
  requirements: []
185
- rubygems_version: 3.0.3
186
- signing_key:
186
+ rubygems_version: 3.3.3
187
+ signing_key:
187
188
  specification_version: 4
188
189
  summary: Easily perform complex search engine like fulltext queries on your ActiveRecord
189
190
  models
190
- test_files:
191
- - test/and_test.rb
192
- - test/boolean_test.rb
193
- - test/database.yml
194
- - test/date_test.rb
195
- - test/datetime_test.rb
196
- - test/default_operator_test.rb
197
- - test/error_test.rb
198
- - test/float_test.rb
199
- - test/fulltext_test.rb
200
- - test/hash_test.rb
201
- - test/integer_test.rb
202
- - test/not_test.rb
203
- - test/or_test.rb
204
- - test/scope_test.rb
205
- - test/search_cop_test.rb
206
- - test/string_test.rb
207
- - test/test_helper.rb
208
- - test/visitor_test.rb
191
+ test_files: []