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 +4 -4
- data/.github/workflows/test.yml +11 -3
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +5 -0
- data/gemfiles/rails7.gemfile +13 -0
- data/lib/search_cop/query_builder.rb +1 -1
- data/lib/search_cop/version.rb +1 -1
- data/search_cop.gemspec +0 -1
- data/test/search_cop_test.rb +9 -0
- data/test/test_helper.rb +8 -0
- metadata +8 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07623ce75206a9b6b4455141697c09782649b05f1073ec27c965a7a4fdf2862a
|
4
|
+
data.tar.gz: 5adef700f6a6514d0d1de0b1f17958d03ecacc0a0f83df57de5aff480bc96da5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbe73b6ec59b87263d9bfd7d4740618deab1dd7d4867dcb39a864e75db8614f08beed34518477791dd3d66f10ee8461a1282a3d81d35ee17b2a7de26d8c995cf
|
7
|
+
data.tar.gz: c131ea06253e994bc5550570708cc5dc973b5392ca208020de08c3384153492c0bc9820438fc0d32c596ec46f27c9982b445d98b80363a89764b6461a4a35706
|
data/.github/workflows/test.yml
CHANGED
@@ -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.
|
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:
|
38
|
+
- uses: ruby/setup-ruby@v1
|
31
39
|
with:
|
32
40
|
ruby-version: ${{ matrix.ruby }}
|
33
41
|
- name: test
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/search_cop/version.rb
CHANGED
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"
|
data/test/search_cop_test.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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: []
|