pursuit 0.4.3 → 1.0.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/rubygem.yaml +46 -0
- data/.ruby-version +1 -1
- data/Gemfile +15 -0
- data/Gemfile.lock +127 -86
- data/LICENSE +174 -21
- data/README.md +210 -27
- data/bin/console +10 -0
- data/config.ru +2 -3
- data/lib/pursuit/aggregate_modifier_not_found.rb +20 -0
- data/lib/pursuit/aggregate_modifier_required.rb +20 -0
- data/lib/pursuit/aggregate_modifiers_not_available.rb +13 -0
- data/lib/pursuit/attribute_not_found.rb +20 -0
- data/lib/pursuit/constants.rb +1 -1
- data/lib/pursuit/error.rb +7 -0
- data/lib/pursuit/predicate_parser.rb +181 -0
- data/lib/pursuit/predicate_search.rb +83 -0
- data/lib/pursuit/predicate_transform.rb +231 -0
- data/lib/pursuit/query_error.rb +7 -0
- data/lib/pursuit/simple_search.rb +64 -0
- data/lib/pursuit/term_parser.rb +44 -0
- data/lib/pursuit/term_search.rb +69 -0
- data/lib/pursuit/term_transform.rb +35 -0
- data/lib/pursuit.rb +19 -5
- data/pursuit.gemspec +5 -18
- data/spec/internal/app/models/application_record.rb +5 -0
- data/spec/internal/app/models/product.rb +25 -9
- data/spec/internal/app/models/product_category.rb +23 -1
- data/spec/internal/app/models/product_variation.rb +26 -1
- data/spec/lib/pursuit/predicate_parser_spec.rb +1604 -0
- data/spec/lib/pursuit/predicate_search_spec.rb +80 -0
- data/spec/lib/pursuit/predicate_transform_spec.rb +624 -0
- data/spec/lib/pursuit/simple_search_spec.rb +59 -0
- data/spec/lib/pursuit/term_parser_spec.rb +271 -0
- data/spec/lib/pursuit/term_search_spec.rb +71 -0
- data/spec/lib/pursuit/term_transform_spec.rb +105 -0
- data/spec/spec_helper.rb +2 -3
- data/travis/gemfiles/{5.2.gemfile → 7.1.gemfile} +2 -2
- metadata +38 -197
- data/.travis.yml +0 -25
- data/lib/pursuit/dsl.rb +0 -28
- data/lib/pursuit/railtie.rb +0 -13
- data/lib/pursuit/search.rb +0 -172
- data/lib/pursuit/search_options.rb +0 -86
- data/lib/pursuit/search_term_parser.rb +0 -46
- data/spec/lib/pursuit/dsl_spec.rb +0 -22
- data/spec/lib/pursuit/search_options_spec.rb +0 -146
- data/spec/lib/pursuit/search_spec.rb +0 -516
- data/spec/lib/pursuit/search_term_parser_spec.rb +0 -34
- data/travis/gemfiles/6.0.gemfile +0 -8
- data/travis/gemfiles/6.1.gemfile +0 -8
- data/travis/gemfiles/7.0.gemfile +0 -8
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe Pursuit::SearchTermParser do
|
4
|
-
subject(:parser) { described_class.new(query, keys: keys) }
|
5
|
-
|
6
|
-
let(:keys) { %w[title description rating stock_status] }
|
7
|
-
let(:query) do
|
8
|
-
"plain title!='Socks' description*=\"green\" stock_status==in_stock shirt rating>=2 other*=thing rating<5"
|
9
|
-
end
|
10
|
-
|
11
|
-
describe '#unkeyed_term' do
|
12
|
-
subject(:unkeyed_term) { parser.unkeyed_term }
|
13
|
-
|
14
|
-
it 'is expected to eq the correct unkeyed term' do
|
15
|
-
expect(unkeyed_term).to eq('plain shirt other*=thing')
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#keyed_terms' do
|
20
|
-
subject(:keyed_terms) { parser.keyed_terms }
|
21
|
-
|
22
|
-
it 'is expected to eq the correct keyed terms' do
|
23
|
-
expect(keyed_terms).to eq(
|
24
|
-
[
|
25
|
-
Pursuit::SearchTermParser::KeyedTerm.new('title', '!=', 'Socks'),
|
26
|
-
Pursuit::SearchTermParser::KeyedTerm.new('description', '*=', 'green'),
|
27
|
-
Pursuit::SearchTermParser::KeyedTerm.new('stock_status', '==', 'in_stock'),
|
28
|
-
Pursuit::SearchTermParser::KeyedTerm.new('rating', '>=', '2'),
|
29
|
-
Pursuit::SearchTermParser::KeyedTerm.new('rating', '<', '5')
|
30
|
-
]
|
31
|
-
)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/travis/gemfiles/6.0.gemfile
DELETED
data/travis/gemfiles/6.1.gemfile
DELETED