LittleWeasel 5.0.5 → 5.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +36 -29
- data/LittleWeasel.gemspec +8 -8
- 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 +33 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36bf2a06e3f2b8fa3284a174a5a934f94b6e1f286edfd491f131a48fc8735dcb
|
4
|
+
data.tar.gz: 8b204f224a6980afbbf8a519cf6a176149234cd7cf36d2b29395feb0fdf5f1fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0472bd090c44f129274614c44a1a0841158159330bea5c77c5488e4a1d457588df902f14e5b2937b0fa1cbf90244329ee13441afe0031e3a96d0814c91b5f20
|
7
|
+
data.tar.gz: 0b0e700fc77c131d0f67143caaa1e2fe585df7308f0582a53596e4e0f65937e8a525e6e31bff14e0f7ad79ef0df1eeb83f678219008736c9b79f0ea8c4112754
|
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,18 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
LittleWeasel (5.0.
|
5
|
-
activesupport (~>
|
4
|
+
LittleWeasel (5.0.7)
|
5
|
+
activesupport (~> 7.0.8)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (
|
10
|
+
activesupport (7.0.8)
|
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
|
-
zeitwerk (~> 2.3)
|
16
15
|
ast (2.4.2)
|
17
16
|
benchmark-ips (2.12.0)
|
18
17
|
byebug (11.1.3)
|
@@ -20,15 +19,17 @@ GEM
|
|
20
19
|
concurrent-ruby (1.2.2)
|
21
20
|
diff-lcs (1.5.0)
|
22
21
|
docile (1.4.0)
|
23
|
-
factory_bot (6.
|
22
|
+
factory_bot (6.3.0)
|
24
23
|
activesupport (>= 5.0.0)
|
25
24
|
i18n (1.14.1)
|
26
25
|
concurrent-ruby (~> 1.0)
|
26
|
+
json (2.6.3)
|
27
27
|
kwalify (0.7.2)
|
28
|
+
language_server-protocol (3.17.0.3)
|
28
29
|
method_source (1.0.0)
|
29
|
-
minitest (5.
|
30
|
+
minitest (5.20.0)
|
30
31
|
parallel (1.23.0)
|
31
|
-
parser (3.2.2.
|
32
|
+
parser (3.2.2.4)
|
32
33
|
ast (~> 2.4.1)
|
33
34
|
racc
|
34
35
|
pry (0.14.2)
|
@@ -45,7 +46,7 @@ GEM
|
|
45
46
|
kwalify (~> 0.7.0)
|
46
47
|
parser (~> 3.2.0)
|
47
48
|
rainbow (>= 2.0, < 4.0)
|
48
|
-
regexp_parser (2.8.
|
49
|
+
regexp_parser (2.8.2)
|
49
50
|
rexml (3.2.6)
|
50
51
|
rspec (3.12.0)
|
51
52
|
rspec-core (~> 3.12.0)
|
@@ -60,25 +61,32 @@ GEM
|
|
60
61
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
62
|
rspec-support (~> 3.12.0)
|
62
63
|
rspec-support (3.12.1)
|
63
|
-
rubocop (1.
|
64
|
+
rubocop (1.57.2)
|
65
|
+
json (~> 2.3)
|
66
|
+
language_server-protocol (>= 3.17.0)
|
64
67
|
parallel (~> 1.10)
|
65
|
-
parser (>= 3.
|
68
|
+
parser (>= 3.2.2.4)
|
66
69
|
rainbow (>= 2.2.2, < 4.0)
|
67
70
|
regexp_parser (>= 1.8, < 3.0)
|
68
|
-
rexml
|
69
|
-
rubocop-ast (>= 1.
|
71
|
+
rexml (>= 3.2.5, < 4.0)
|
72
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
70
73
|
ruby-progressbar (~> 1.7)
|
71
|
-
unicode-display_width (>=
|
72
|
-
rubocop-ast (1.
|
74
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
75
|
+
rubocop-ast (1.30.0)
|
73
76
|
parser (>= 3.2.1.0)
|
74
|
-
rubocop-
|
77
|
+
rubocop-capybara (2.19.0)
|
78
|
+
rubocop (~> 1.41)
|
79
|
+
rubocop-factory_bot (2.24.0)
|
80
|
+
rubocop (~> 1.33)
|
81
|
+
rubocop-performance (1.19.1)
|
75
82
|
rubocop (>= 1.7.0, < 2.0)
|
76
83
|
rubocop-ast (>= 0.4.0)
|
77
|
-
rubocop-rspec (2.
|
78
|
-
rubocop (~> 1.
|
79
|
-
rubocop-
|
84
|
+
rubocop-rspec (2.25.0)
|
85
|
+
rubocop (~> 1.40)
|
86
|
+
rubocop-capybara (~> 2.17)
|
87
|
+
rubocop-factory_bot (~> 2.22)
|
80
88
|
ruby-progressbar (1.13.0)
|
81
|
-
simplecov (0.
|
89
|
+
simplecov (0.22.0)
|
82
90
|
docile (~> 1.1)
|
83
91
|
simplecov-html (~> 0.11)
|
84
92
|
simplecov_json_formatter (~> 0.1)
|
@@ -86,10 +94,9 @@ GEM
|
|
86
94
|
simplecov_json_formatter (0.1.4)
|
87
95
|
tzinfo (2.0.6)
|
88
96
|
concurrent-ruby (~> 1.0)
|
89
|
-
unicode-display_width (2.
|
97
|
+
unicode-display_width (2.5.0)
|
90
98
|
webrick (1.8.1)
|
91
99
|
yard (0.9.34)
|
92
|
-
zeitwerk (2.6.11)
|
93
100
|
|
94
101
|
PLATFORMS
|
95
102
|
ruby
|
@@ -97,19 +104,19 @@ PLATFORMS
|
|
97
104
|
DEPENDENCIES
|
98
105
|
LittleWeasel!
|
99
106
|
benchmark-ips (~> 2.3)
|
100
|
-
bundler (~> 2.
|
101
|
-
factory_bot (~> 6.
|
107
|
+
bundler (~> 2.4, >= 2.4.21)
|
108
|
+
factory_bot (~> 6.3)
|
102
109
|
pry-byebug (~> 3.9)
|
103
110
|
rake (~> 12.3, >= 12.3.3)
|
104
111
|
redcarpet (~> 3.5, >= 3.5.1)
|
105
112
|
reek (~> 6.0, >= 6.0.4)
|
106
|
-
rspec (~> 3.
|
107
|
-
rubocop (~> 1.
|
108
|
-
rubocop-performance (~> 1.
|
109
|
-
rubocop-rspec (~> 2.
|
110
|
-
simplecov (~> 0.
|
113
|
+
rspec (~> 3.12)
|
114
|
+
rubocop (~> 1.56, >= 1.56.2)
|
115
|
+
rubocop-performance (~> 1.19)
|
116
|
+
rubocop-rspec (~> 2.23, >= 2.23.2)
|
117
|
+
simplecov (~> 0.22.0)
|
111
118
|
webrick (~> 1.7)
|
112
119
|
yard (~> 0.9.26)
|
113
120
|
|
114
121
|
BUNDLED WITH
|
115
|
-
2.
|
122
|
+
2.4.21
|
data/LittleWeasel.gemspec
CHANGED
@@ -20,21 +20,21 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
22
|
spec.required_ruby_version = '~> 3.0', '>= 3.0.1'
|
23
|
-
spec.add_runtime_dependency 'activesupport', '~>
|
23
|
+
spec.add_runtime_dependency 'activesupport', '~> 7.0.8'
|
24
24
|
spec.add_development_dependency 'benchmark-ips', '~> 2.3'
|
25
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
26
|
-
spec.add_development_dependency 'factory_bot', '~> 6.
|
25
|
+
spec.add_development_dependency 'bundler', '~> 2.4', '>= 2.4.21'
|
26
|
+
spec.add_development_dependency 'factory_bot', '~> 6.3'
|
27
27
|
spec.add_development_dependency 'pry-byebug', '~> 3.9'
|
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
|