LittleWeasel 5.0.5 → 5.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +27 -16
- data/LittleWeasel.gemspec +5 -5
- data/lib/LittleWeasel/version.rb +1 -1
- data/spec/factories/dictionary.rb +27 -27
- data/spec/factories/dictionary_cache_service.rb +4 -6
- data/spec/factories/dictionary_creator_service.rb +1 -1
- data/spec/factories/dictionary_file_loader_service.rb +1 -1
- data/spec/factories/dictionary_hash.rb +26 -26
- data/spec/factories/dictionary_key.rb +1 -1
- data/spec/factories/dictionary_killer_service.rb +1 -1
- data/spec/factories/dictionary_manager.rb +1 -1
- data/spec/factories/dictionary_metadata.rb +1 -1
- data/spec/factories/dictionary_metadata_service.rb +1 -1
- data/spec/factories/numeric_filter.rb +1 -1
- data/spec/factories/preprocessed_word.rb +1 -1
- data/spec/factories/preprocessed_words.rb +1 -1
- data/spec/factories/single_character_word_filter.rb +1 -1
- data/spec/factories/word_results.rb +1 -1
- data/spec/lib/LittleWeasel/block_results_spec.rb +23 -23
- data/spec/lib/LittleWeasel/configure_spec.rb +3 -3
- data/spec/lib/LittleWeasel/dictionary_key_spec.rb +9 -9
- data/spec/lib/LittleWeasel/dictionary_manager_spec.rb +29 -29
- data/spec/lib/LittleWeasel/dictionary_spec.rb +30 -29
- data/spec/lib/LittleWeasel/filters/en_us/currency_filter_spec.rb +26 -26
- data/spec/lib/LittleWeasel/filters/en_us/numeric_filter_spec.rb +17 -17
- data/spec/lib/LittleWeasel/filters/en_us/single_character_word_filter_spec.rb +8 -8
- data/spec/lib/LittleWeasel/filters/word_filter_managable_spec.rb +19 -19
- data/spec/lib/LittleWeasel/filters/word_filter_spec.rb +17 -17
- data/spec/lib/LittleWeasel/filters/word_filter_validatable_spec.rb +27 -12
- data/spec/lib/LittleWeasel/filters/word_filters_validatable_spec.rb +6 -6
- data/spec/lib/LittleWeasel/integraton_tests/dictionary_integration_spec.rb +23 -23
- data/spec/lib/LittleWeasel/metadata/dictionary_creator_servicable_spec.rb +7 -6
- data/spec/lib/LittleWeasel/metadata/dictionary_metadata_spec.rb +13 -13
- data/spec/lib/LittleWeasel/metadata/invalid_words_metadata_spec.rb +17 -17
- data/spec/lib/LittleWeasel/metadata/metadata_observerable_spec.rb +1 -1
- data/spec/lib/LittleWeasel/modules/dictionary_file_loader_spec.rb +30 -30
- data/spec/lib/LittleWeasel/modules/dictionary_sourceable_spec.rb +21 -21
- data/spec/lib/LittleWeasel/modules/language_spec.rb +5 -5
- data/spec/lib/LittleWeasel/modules/locale_spec.rb +1 -1
- data/spec/lib/LittleWeasel/modules/region_spec.rb +5 -5
- data/spec/lib/LittleWeasel/preprocessors/en_us/capitalize_preprocessor_spec.rb +8 -6
- data/spec/lib/LittleWeasel/preprocessors/preprocessed_word_spec.rb +3 -3
- data/spec/lib/LittleWeasel/preprocessors/preprocessed_word_validatable_spec.rb +14 -3
- data/spec/lib/LittleWeasel/preprocessors/preprocessed_words_spec.rb +8 -10
- data/spec/lib/LittleWeasel/preprocessors/preprocessed_words_validatable_spec.rb +6 -4
- data/spec/lib/LittleWeasel/preprocessors/word_preprocessor_managable_spec.rb +27 -28
- data/spec/lib/LittleWeasel/preprocessors/word_preprocessor_spec.rb +25 -29
- data/spec/lib/LittleWeasel/preprocessors/word_preprocessor_validatable_spec.rb +10 -2
- data/spec/lib/LittleWeasel/preprocessors/word_preprocessors_validatable_spec.rb +4 -6
- data/spec/lib/LittleWeasel/services/dictionary_cache_service_spec.rb +51 -49
- data/spec/lib/LittleWeasel/services/dictionary_creator_service_spec.rb +14 -14
- data/spec/lib/LittleWeasel/services/dictionary_file_loader_service_spec.rb +30 -30
- data/spec/lib/LittleWeasel/services/dictionary_metadata_service_spec.rb +22 -22
- data/spec/lib/LittleWeasel/word_results_spec.rb +29 -32
- data/spec/lib/LittleWeasel/workflow/workflow_spec.rb +2 -2
- data/spec/spec_helper.rb +56 -56
- data/spec/support/factory_bot.rb +1 -2
- data/spec/support/file_helpers.rb +2 -2
- data/spec/support/general_helpers.rb +2 -1
- data/spec/support/shared_contexts.rb +13 -9
- data/spec/support/shared_examples.rb +10 -8
- metadata +25 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55f9cf600592a9a3217fad6dc7ce029bcdfbb0d15118d6dc0711cbd67cf8e0d5
|
4
|
+
data.tar.gz: a017d1843dd2c86f7b1baa60dd599cef3628f0bd1504846f71081e8cd952ef90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7043b5ef0e1f89aca8b21736709c7d0707b3a0218f55fab27b47335afe3a9c0926f6847fac7d2917420803bd0a0b2573de61322d7079024eb31842176d399250
|
7
|
+
data.tar.gz: 3a7cd00a0cb070eb6f4f6a82fe492b85667d6b635a50b593428ef4941c9cd07cb350554b3a17d9ae023e10882908cb718df65be8cc56b68ffa928aa39da604b5
|
data/.rubocop.yml
CHANGED
@@ -13,6 +13,8 @@ AllCops:
|
|
13
13
|
- '*.gemspec'
|
14
14
|
- 'spec/**/*'
|
15
15
|
- 'vendor/**/*'
|
16
|
+
- 'scratch*.rb'
|
17
|
+
- 'snippets*.rb'
|
16
18
|
|
17
19
|
# Align the elements of a hash literal if they span more than one line.
|
18
20
|
Layout/HashAlignment:
|
@@ -115,7 +117,7 @@ Layout/LineLength:
|
|
115
117
|
# Avoid methods longer than 15 lines of code.
|
116
118
|
Metrics/MethodLength:
|
117
119
|
Max: 20
|
118
|
-
|
120
|
+
AllowedMethods:
|
119
121
|
- swagger_path
|
120
122
|
- operation
|
121
123
|
|
@@ -124,9 +126,12 @@ Metrics/MethodLength:
|
|
124
126
|
Metrics/PerceivedComplexity:
|
125
127
|
Max: 10
|
126
128
|
|
127
|
-
|
128
|
-
|
129
|
-
|
129
|
+
NestedGroups:
|
130
|
+
Max: 4
|
131
|
+
|
132
|
+
# Naming/FileName:
|
133
|
+
# Exclude:
|
134
|
+
# - 'lib/file.rb'
|
130
135
|
|
131
136
|
# Allow `downcase == ` instead of forcing `casecmp`
|
132
137
|
Performance/Casecmp:
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
LittleWeasel (5.0.
|
4
|
+
LittleWeasel (5.0.6)
|
5
5
|
activesupport (~> 6.1, >= 6.1.3.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (6.1.7.
|
10
|
+
activesupport (6.1.7.6)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (>= 1.6, < 2)
|
13
13
|
minitest (>= 5.1)
|
14
14
|
tzinfo (~> 2.0)
|
15
15
|
zeitwerk (~> 2.3)
|
16
16
|
ast (2.4.2)
|
17
|
+
base64 (0.1.1)
|
17
18
|
benchmark-ips (2.12.0)
|
18
19
|
byebug (11.1.3)
|
19
20
|
coderay (1.1.3)
|
@@ -24,7 +25,9 @@ GEM
|
|
24
25
|
activesupport (>= 5.0.0)
|
25
26
|
i18n (1.14.1)
|
26
27
|
concurrent-ruby (~> 1.0)
|
28
|
+
json (2.6.3)
|
27
29
|
kwalify (0.7.2)
|
30
|
+
language_server-protocol (3.17.0.3)
|
28
31
|
method_source (1.0.0)
|
29
32
|
minitest (5.19.0)
|
30
33
|
parallel (1.23.0)
|
@@ -60,25 +63,33 @@ GEM
|
|
60
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
64
|
rspec-support (~> 3.12.0)
|
62
65
|
rspec-support (3.12.1)
|
63
|
-
rubocop (1.
|
66
|
+
rubocop (1.56.2)
|
67
|
+
base64 (~> 0.1.1)
|
68
|
+
json (~> 2.3)
|
69
|
+
language_server-protocol (>= 3.17.0)
|
64
70
|
parallel (~> 1.10)
|
65
|
-
parser (>= 3.
|
71
|
+
parser (>= 3.2.2.3)
|
66
72
|
rainbow (>= 2.2.2, < 4.0)
|
67
73
|
regexp_parser (>= 1.8, < 3.0)
|
68
|
-
rexml
|
69
|
-
rubocop-ast (>= 1.
|
74
|
+
rexml (>= 3.2.5, < 4.0)
|
75
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
70
76
|
ruby-progressbar (~> 1.7)
|
71
|
-
unicode-display_width (>=
|
77
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
72
78
|
rubocop-ast (1.29.0)
|
73
79
|
parser (>= 3.2.1.0)
|
80
|
+
rubocop-capybara (2.18.0)
|
81
|
+
rubocop (~> 1.41)
|
82
|
+
rubocop-factory_bot (2.23.1)
|
83
|
+
rubocop (~> 1.33)
|
74
84
|
rubocop-performance (1.19.0)
|
75
85
|
rubocop (>= 1.7.0, < 2.0)
|
76
86
|
rubocop-ast (>= 0.4.0)
|
77
|
-
rubocop-rspec (2.
|
78
|
-
rubocop (~> 1.
|
79
|
-
rubocop-
|
87
|
+
rubocop-rspec (2.23.2)
|
88
|
+
rubocop (~> 1.33)
|
89
|
+
rubocop-capybara (~> 2.17)
|
90
|
+
rubocop-factory_bot (~> 2.22)
|
80
91
|
ruby-progressbar (1.13.0)
|
81
|
-
simplecov (0.
|
92
|
+
simplecov (0.22.0)
|
82
93
|
docile (~> 1.1)
|
83
94
|
simplecov-html (~> 0.11)
|
84
95
|
simplecov_json_formatter (~> 0.1)
|
@@ -103,11 +114,11 @@ DEPENDENCIES
|
|
103
114
|
rake (~> 12.3, >= 12.3.3)
|
104
115
|
redcarpet (~> 3.5, >= 3.5.1)
|
105
116
|
reek (~> 6.0, >= 6.0.4)
|
106
|
-
rspec (~> 3.
|
107
|
-
rubocop (~> 1.
|
108
|
-
rubocop-performance (~> 1.
|
109
|
-
rubocop-rspec (~> 2.
|
110
|
-
simplecov (~> 0.
|
117
|
+
rspec (~> 3.12)
|
118
|
+
rubocop (~> 1.56, >= 1.56.2)
|
119
|
+
rubocop-performance (~> 1.19)
|
120
|
+
rubocop-rspec (~> 2.23, >= 2.23.2)
|
121
|
+
simplecov (~> 0.22.0)
|
111
122
|
webrick (~> 1.7)
|
112
123
|
yard (~> 0.9.26)
|
113
124
|
|
data/LittleWeasel.gemspec
CHANGED
@@ -28,13 +28,13 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
29
29
|
spec.add_development_dependency 'redcarpet', '~> 3.5', '>= 3.5.1'
|
30
30
|
spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.4'
|
31
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
32
32
|
# This verson of rubocop is returning errors.
|
33
33
|
# spec.add_development_dependency 'rubocop', '~> 1.14'
|
34
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
35
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.
|
36
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 2.
|
37
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
34
|
+
spec.add_development_dependency 'rubocop', '~> 1.56', '>= 1.56.2'
|
35
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.19'
|
36
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.23', '>= 2.23.2'
|
37
|
+
spec.add_development_dependency 'simplecov', '~> 0.22.0'
|
38
38
|
# Needed for yard
|
39
39
|
spec.add_development_dependency 'webrick', '~> 1.7'
|
40
40
|
spec.add_development_dependency 'yard', '~> 0.9.26'
|
data/lib/LittleWeasel/version.rb
CHANGED
@@ -1,38 +1,38 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
|
-
factory :dictionary, class: LittleWeasel::Dictionary do
|
4
|
+
factory :dictionary, class: 'LittleWeasel::Dictionary' do
|
5
5
|
dictionary_key { create(:dictionary_key) }
|
6
6
|
dictionary_cache { {} }
|
7
7
|
dictionary_metadata { {} }
|
8
8
|
word_filters {}
|
9
9
|
dictionary_words do
|
10
|
-
%w
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
10
|
+
%w[apple
|
11
|
+
better
|
12
|
+
cat
|
13
|
+
dog
|
14
|
+
everyone
|
15
|
+
fat
|
16
|
+
game
|
17
|
+
help
|
18
|
+
italic
|
19
|
+
jasmine
|
20
|
+
kelp
|
21
|
+
love
|
22
|
+
man
|
23
|
+
nope
|
24
|
+
octopus
|
25
|
+
popeye
|
26
|
+
queue
|
27
|
+
ruby
|
28
|
+
stop
|
29
|
+
top
|
30
|
+
ultimate
|
31
|
+
very
|
32
|
+
was
|
33
|
+
xylophone
|
34
|
+
yes
|
35
|
+
zebra]
|
36
36
|
end
|
37
37
|
|
38
38
|
skip_create
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'pry'
|
4
4
|
|
5
5
|
FactoryBot.define do
|
6
|
-
factory :dictionary_cache_service, class: LittleWeasel::Services::DictionaryCacheService do
|
6
|
+
factory :dictionary_cache_service, class: 'LittleWeasel::Services::DictionaryCacheService' do
|
7
7
|
dictionary_key { create(:dictionary_key) }
|
8
8
|
dictionary_cache { {} }
|
9
9
|
|
@@ -57,11 +57,9 @@ FactoryBot.define do
|
|
57
57
|
dictionary_memory_source = evaluator.dictionary_memory_source
|
58
58
|
dictionary_file_source = evaluator.dictionary_file_source
|
59
59
|
|
60
|
-
if load
|
61
|
-
|
62
|
-
|
63
|
-
"must be present if transient attribute load is true: #{dictionary_reference}"
|
64
|
-
end
|
60
|
+
if load && !(dictionary_memory_source.present? || dictionary_file_source.present?)
|
61
|
+
raise 'Transient attributes dictionary_memory_source or dictionary_file_source ' \
|
62
|
+
"must be present if transient attribute load is true: #{dictionary_reference}"
|
65
63
|
end
|
66
64
|
|
67
65
|
if dictionary_file_source
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
|
-
factory :dictionary_creator_service, class: LittleWeasel::Services::DictionaryCreatorService do
|
4
|
+
factory :dictionary_creator_service, class: 'LittleWeasel::Services::DictionaryCreatorService' do
|
5
5
|
dictionary_key { create(:dictionary_key) }
|
6
6
|
dictionary_cache { {} }
|
7
7
|
dictionary_metadata { {} }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
|
-
factory :dictionary_file_loader_service, class: LittleWeasel::Services::DictionaryFileLoaderService do
|
4
|
+
factory :dictionary_file_loader_service, class: 'LittleWeasel::Services::DictionaryFileLoaderService' do
|
5
5
|
dictionary_key { create(:dictionary_key) }
|
6
6
|
dictionary_cache { {} }
|
7
7
|
|
@@ -3,32 +3,32 @@
|
|
3
3
|
FactoryBot.define do
|
4
4
|
factory :dictionary_hash, class: Hash do
|
5
5
|
dictionary_words do
|
6
|
-
%w
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
6
|
+
%w[apple
|
7
|
+
better
|
8
|
+
cat
|
9
|
+
dog
|
10
|
+
everyone
|
11
|
+
fat
|
12
|
+
game
|
13
|
+
help
|
14
|
+
italic
|
15
|
+
jasmine
|
16
|
+
kelp
|
17
|
+
love
|
18
|
+
man
|
19
|
+
nope
|
20
|
+
octopus
|
21
|
+
popeye
|
22
|
+
queue
|
23
|
+
ruby
|
24
|
+
stop
|
25
|
+
top
|
26
|
+
ultimate
|
27
|
+
very
|
28
|
+
was
|
29
|
+
xylophone
|
30
|
+
yes
|
31
|
+
zebra]
|
32
32
|
end
|
33
33
|
|
34
34
|
skip_create
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
|
-
factory :dictionary_killer_service, class: LittleWeasel::Services::DictionaryKillerService do
|
4
|
+
factory :dictionary_killer_service, class: 'LittleWeasel::Services::DictionaryKillerService' do
|
5
5
|
dictionary_key { create(:dictionary_key) }
|
6
6
|
dictionary_cache { {} }
|
7
7
|
dictionary_metadata { {} }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
|
-
factory :dictionary_metadata, class: LittleWeasel::Metadata::DictionaryMetadata do
|
4
|
+
factory :dictionary_metadata, class: 'LittleWeasel::Metadata::DictionaryMetadata' do
|
5
5
|
dictionary_words {}
|
6
6
|
dictionary_key { create(:dictionary_key) }
|
7
7
|
dictionary_cache { {} }
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'pry'
|
4
4
|
|
5
5
|
FactoryBot.define do
|
6
|
-
factory :dictionary_metadata_service, class: LittleWeasel::Services::DictionaryMetadataService do
|
6
|
+
factory :dictionary_metadata_service, class: 'LittleWeasel::Services::DictionaryMetadataService' do
|
7
7
|
dictionary_key { create(:dictionary_key) }
|
8
8
|
dictionary_cache { {} }
|
9
9
|
dictionary_metadata { {} }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
|
-
factory :preprocessed_word, class: LittleWeasel::Preprocessors::PreprocessedWord do
|
4
|
+
factory :preprocessed_word, class: 'LittleWeasel::Preprocessors::PreprocessedWord' do
|
5
5
|
original_word {}
|
6
6
|
preprocessed {}
|
7
7
|
preprocessed_word {}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'pry'
|
4
4
|
|
5
5
|
FactoryBot.define do
|
6
|
-
factory :preprocessed_words, class: LittleWeasel::Preprocessors::PreprocessedWords do
|
6
|
+
factory :preprocessed_words, class: 'LittleWeasel::Preprocessors::PreprocessedWords' do
|
7
7
|
original_word { 'word' }
|
8
8
|
preprocessed_words {}
|
9
9
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
|
-
factory :single_character_word_filter, class: LittleWeasel::Filters::EnUs::SingleCharacterWordFilter do
|
4
|
+
factory :single_character_word_filter, class: 'LittleWeasel::Filters::EnUs::SingleCharacterWordFilter' do
|
5
5
|
filter_on { true }
|
6
6
|
|
7
7
|
skip_create
|
@@ -11,10 +11,10 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
11
11
|
|
12
12
|
let(:original_word_block) { 'Original word block' }
|
13
13
|
|
14
|
-
|
14
|
+
# .new
|
15
15
|
describe '.new' do
|
16
16
|
it 'instantiates an object' do
|
17
|
-
expect { subject }.
|
17
|
+
expect { subject }.not_to raise_error
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'initializes #word_results to an empty Array' do
|
@@ -26,7 +26,7 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
# <<
|
30
30
|
describe '<<' do
|
31
31
|
context 'with an invalid argument' do
|
32
32
|
it 'raises an error' do
|
@@ -42,7 +42,7 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
#success?
|
45
|
+
# success?
|
46
46
|
describe '#success?' do
|
47
47
|
before do
|
48
48
|
subject << ceate_word_results(word: 'word01', word_valid: true)
|
@@ -81,7 +81,7 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
#words_valid?
|
84
|
+
# words_valid?
|
85
85
|
describe '#words_valid?' do
|
86
86
|
before do
|
87
87
|
subject << ceate_word_results(word: 'word01', word_valid: true)
|
@@ -105,7 +105,7 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
#filters_match?
|
108
|
+
# filters_match?
|
109
109
|
describe '#filters_match?' do
|
110
110
|
before do
|
111
111
|
subject << ceate_word_results(word: 'word01', filters_matched: [:matched_filter])
|
@@ -129,7 +129,7 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
#preprocessed_words?
|
132
|
+
# preprocessed_words?
|
133
133
|
describe '#preprocessed_words?' do
|
134
134
|
before do
|
135
135
|
subject << ceate_word_results(word: word, preprocessed_words: preprocessed_words)
|
@@ -145,7 +145,7 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
-
#preprocessed_words_or_original_words
|
148
|
+
# preprocessed_words_or_original_words
|
149
149
|
describe '#preprocessed_words_or_original_words' do
|
150
150
|
context 'with all preprocessed words' do
|
151
151
|
before do
|
@@ -153,16 +153,16 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
153
153
|
subject << ceate_word_results(word: words[1], preprocessed_words: preprocessed_words[1])
|
154
154
|
end
|
155
155
|
|
156
|
-
let(:words) { %w
|
156
|
+
let(:words) { %w[word1 word2] }
|
157
157
|
let(:preprocessed_words) do
|
158
158
|
[
|
159
|
-
|
160
|
-
|
159
|
+
create(:preprocessed_words, original_word: words[0], with_word_processors: 1),
|
160
|
+
create(:preprocessed_words, original_word: words[1], with_word_processors: 2)
|
161
161
|
]
|
162
162
|
end
|
163
163
|
|
164
164
|
it 'returns all the preprocessed words' do
|
165
|
-
expect(subject.preprocessed_words_or_original_words).to eq %w
|
165
|
+
expect(subject.preprocessed_words_or_original_words).to eq %w[word1-0 word2-0-1]
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
@@ -172,10 +172,10 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
172
172
|
subject << ceate_word_results(word: words[1])
|
173
173
|
end
|
174
174
|
|
175
|
-
let(:words) { %w
|
175
|
+
let(:words) { %w[word1 word2] }
|
176
176
|
|
177
177
|
it 'returns all the original words' do
|
178
|
-
expect(subject.preprocessed_words_or_original_words).to eq %w
|
178
|
+
expect(subject.preprocessed_words_or_original_words).to eq %w[word1 word2]
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
@@ -187,21 +187,21 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
187
187
|
subject << ceate_word_results(word: words[3], word_valid: true, preprocessed_words: preprocessed_words[1])
|
188
188
|
end
|
189
189
|
|
190
|
-
let(:words) { %w
|
190
|
+
let(:words) { %w[word0 word1 word2 word3] }
|
191
191
|
let(:preprocessed_words) do
|
192
192
|
[
|
193
|
-
|
194
|
-
|
193
|
+
create(:preprocessed_words, original_word: words[1], with_word_processors: 1),
|
194
|
+
create(:preprocessed_words, original_word: words[3], with_word_processors: 2)
|
195
195
|
]
|
196
196
|
end
|
197
197
|
|
198
198
|
it 'returns all the original and preprocessed words' do
|
199
|
-
expect(subject.preprocessed_words_or_original_words).to eq %w
|
199
|
+
expect(subject.preprocessed_words_or_original_words).to eq %w[word0 word1-0 word2 word3-0-1]
|
200
200
|
end
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
|
-
#words_cached?
|
204
|
+
# words_cached?
|
205
205
|
describe '#words_cached?' do
|
206
206
|
before do
|
207
207
|
subject << ceate_word_results(word: words[0])
|
@@ -210,7 +210,7 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
210
210
|
subject << ceate_word_results(word: words[3])
|
211
211
|
end
|
212
212
|
|
213
|
-
let(:words) { %w
|
213
|
+
let(:words) { %w[word1 word2 word3 word4] }
|
214
214
|
|
215
215
|
context 'when all the words are cached' do
|
216
216
|
before do
|
@@ -218,7 +218,7 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
218
218
|
end
|
219
219
|
|
220
220
|
it 'returns true' do
|
221
|
-
expect(subject.words_cached?).to
|
221
|
+
expect(subject.words_cached?).to be true
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
@@ -231,7 +231,7 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
231
231
|
end
|
232
232
|
|
233
233
|
it 'returns false' do
|
234
|
-
expect(subject.words_cached?).to
|
234
|
+
expect(subject.words_cached?).to be false
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
@@ -241,7 +241,7 @@ RSpec.describe LittleWeasel::BlockResults do
|
|
241
241
|
end
|
242
242
|
|
243
243
|
it 'returns false' do
|
244
|
-
expect(subject.words_cached?).to
|
244
|
+
expect(subject.words_cached?).to be false
|
245
245
|
end
|
246
246
|
end
|
247
247
|
end
|
@@ -31,12 +31,12 @@ RSpec.describe LittleWeasel do
|
|
31
31
|
|
32
32
|
describe '#word_block_regex' do
|
33
33
|
it 'set to the default regex to split work blocks by default' do
|
34
|
-
expect(subject.word_block_regex).to eq
|
34
|
+
expect(subject.word_block_regex).to eq(/[[[:word:]]'-]+/)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
|
39
|
+
# .configuration
|
40
40
|
describe '.configuration' do
|
41
41
|
context 'when passing a block' do
|
42
42
|
subject do
|
@@ -49,7 +49,7 @@ RSpec.describe LittleWeasel do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
let(:max_dictionary_file_megabytes) { 1_222_333 }
|
52
|
-
let(:metadata_observers) { %i
|
52
|
+
let(:metadata_observers) { %i[observer0 observer1] }
|
53
53
|
let(:word_block_regex) { :word_block_regex }
|
54
54
|
|
55
55
|
describe '#max_dictionary_file_megabytes=' do
|