LittleWeasel 5.0.4 → 5.0.6

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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +16 -0
  3. data/.rubocop.yml +9 -4
  4. data/CHANGELOG.md +8 -0
  5. data/Gemfile.lock +44 -32
  6. data/LittleWeasel.gemspec +5 -5
  7. data/lib/LittleWeasel/dictionary.rb +1 -1
  8. data/lib/LittleWeasel/errors/dictionary_file_too_large_error.rb +1 -1
  9. data/lib/LittleWeasel/metadata/metadata_observable_validatable.rb +1 -1
  10. data/lib/LittleWeasel/version.rb +1 -1
  11. data/spec/factories/dictionary.rb +27 -27
  12. data/spec/factories/dictionary_cache_service.rb +4 -6
  13. data/spec/factories/dictionary_creator_service.rb +1 -1
  14. data/spec/factories/dictionary_file_loader_service.rb +1 -1
  15. data/spec/factories/dictionary_hash.rb +26 -26
  16. data/spec/factories/dictionary_key.rb +1 -1
  17. data/spec/factories/dictionary_killer_service.rb +1 -1
  18. data/spec/factories/dictionary_manager.rb +1 -1
  19. data/spec/factories/dictionary_metadata.rb +1 -1
  20. data/spec/factories/dictionary_metadata_service.rb +1 -1
  21. data/spec/factories/numeric_filter.rb +1 -1
  22. data/spec/factories/preprocessed_word.rb +1 -1
  23. data/spec/factories/preprocessed_words.rb +1 -1
  24. data/spec/factories/single_character_word_filter.rb +1 -1
  25. data/spec/factories/word_results.rb +1 -1
  26. data/spec/lib/LittleWeasel/block_results_spec.rb +23 -23
  27. data/spec/lib/LittleWeasel/configure_spec.rb +3 -3
  28. data/spec/lib/LittleWeasel/dictionary_key_spec.rb +9 -9
  29. data/spec/lib/LittleWeasel/dictionary_manager_spec.rb +29 -29
  30. data/spec/lib/LittleWeasel/dictionary_spec.rb +30 -29
  31. data/spec/lib/LittleWeasel/filters/en_us/currency_filter_spec.rb +26 -26
  32. data/spec/lib/LittleWeasel/filters/en_us/numeric_filter_spec.rb +17 -17
  33. data/spec/lib/LittleWeasel/filters/en_us/single_character_word_filter_spec.rb +8 -8
  34. data/spec/lib/LittleWeasel/filters/word_filter_managable_spec.rb +19 -19
  35. data/spec/lib/LittleWeasel/filters/word_filter_spec.rb +17 -17
  36. data/spec/lib/LittleWeasel/filters/word_filter_validatable_spec.rb +27 -12
  37. data/spec/lib/LittleWeasel/filters/word_filters_validatable_spec.rb +6 -6
  38. data/spec/lib/LittleWeasel/integraton_tests/dictionary_integration_spec.rb +23 -23
  39. data/spec/lib/LittleWeasel/metadata/dictionary_creator_servicable_spec.rb +7 -6
  40. data/spec/lib/LittleWeasel/metadata/dictionary_metadata_spec.rb +13 -13
  41. data/spec/lib/LittleWeasel/metadata/invalid_words_metadata_spec.rb +17 -17
  42. data/spec/lib/LittleWeasel/metadata/metadata_observerable_spec.rb +1 -1
  43. data/spec/lib/LittleWeasel/modules/dictionary_file_loader_spec.rb +30 -30
  44. data/spec/lib/LittleWeasel/modules/dictionary_sourceable_spec.rb +21 -21
  45. data/spec/lib/LittleWeasel/modules/language_spec.rb +5 -5
  46. data/spec/lib/LittleWeasel/modules/locale_spec.rb +1 -1
  47. data/spec/lib/LittleWeasel/modules/region_spec.rb +5 -5
  48. data/spec/lib/LittleWeasel/preprocessors/en_us/capitalize_preprocessor_spec.rb +8 -6
  49. data/spec/lib/LittleWeasel/preprocessors/preprocessed_word_spec.rb +3 -3
  50. data/spec/lib/LittleWeasel/preprocessors/preprocessed_word_validatable_spec.rb +14 -3
  51. data/spec/lib/LittleWeasel/preprocessors/preprocessed_words_spec.rb +8 -10
  52. data/spec/lib/LittleWeasel/preprocessors/preprocessed_words_validatable_spec.rb +6 -4
  53. data/spec/lib/LittleWeasel/preprocessors/word_preprocessor_managable_spec.rb +27 -28
  54. data/spec/lib/LittleWeasel/preprocessors/word_preprocessor_spec.rb +25 -29
  55. data/spec/lib/LittleWeasel/preprocessors/word_preprocessor_validatable_spec.rb +10 -2
  56. data/spec/lib/LittleWeasel/preprocessors/word_preprocessors_validatable_spec.rb +4 -6
  57. data/spec/lib/LittleWeasel/services/dictionary_cache_service_spec.rb +51 -49
  58. data/spec/lib/LittleWeasel/services/dictionary_creator_service_spec.rb +14 -14
  59. data/spec/lib/LittleWeasel/services/dictionary_file_loader_service_spec.rb +30 -30
  60. data/spec/lib/LittleWeasel/services/dictionary_metadata_service_spec.rb +22 -22
  61. data/spec/lib/LittleWeasel/word_results_spec.rb +29 -32
  62. data/spec/lib/LittleWeasel/workflow/workflow_spec.rb +2 -2
  63. data/spec/spec_helper.rb +56 -56
  64. data/spec/support/factory_bot.rb +1 -2
  65. data/spec/support/file_helpers.rb +2 -2
  66. data/spec/support/general_helpers.rb +2 -1
  67. data/spec/support/shared_contexts.rb +13 -9
  68. data/spec/support/shared_examples.rb +10 -8
  69. metadata +26 -19
@@ -14,17 +14,17 @@ RSpec.describe LittleWeasel::Metadata::DictionaryMetadata do
14
14
  let(:invalid_words_metadata_key) { invalid_words_metadata_class.metadata_key }
15
15
  let(:invalid_words_metadata_class) { LittleWeasel::Metadata::InvalidWordsMetadata }
16
16
 
17
- #.new
17
+ # .new
18
18
  describe '#.new' do
19
19
  context 'with valid arguments' do
20
20
  it 'instantiates the object' do
21
- expect { subject }.to_not raise_error
21
+ expect { subject }.not_to raise_error
22
22
  end
23
23
  end
24
24
 
25
25
  context 'with invalid arguments' do
26
26
  context 'when dictionary_words is nil' do
27
- # Note: do not use the factory for this spec becasue
27
+ # NOTE: do not use the factory for this spec becasue
28
28
  # it creates a dictionary if a nil dictionay is passed
29
29
  # so the test will never pass if using the factory.
30
30
  subject { described_class.new(dictionary_words: dictionary_words, dictionary_key: dictionary_key, dictionary_cache: dictionary_cache, dictionary_metadata: dictionary_metadata) }
@@ -37,7 +37,7 @@ RSpec.describe LittleWeasel::Metadata::DictionaryMetadata do
37
37
  end
38
38
 
39
39
  context 'when dictionary_words is not a Hash' do
40
- let(:dictionary_words) { %w(I am a bad dictionary) }
40
+ let(:dictionary_words) { %w[I am a bad dictionary] }
41
41
 
42
42
  it 'raises an error' do
43
43
  expect { subject }.to raise_error(/Argument dictionary_words is not a Hash/)
@@ -46,7 +46,7 @@ RSpec.describe LittleWeasel::Metadata::DictionaryMetadata do
46
46
  end
47
47
  end
48
48
 
49
- #[]
49
+ # []
50
50
  describe '#[]' do
51
51
  context 'when passing a valid metadata_key' do
52
52
  context 'when it is a key that points to a valid metadata observer' do
@@ -55,7 +55,7 @@ RSpec.describe LittleWeasel::Metadata::DictionaryMetadata do
55
55
  end
56
56
 
57
57
  it 'returns the metadata observer object' do
58
- expect(subject[invalid_words_metadata_key]).to be_kind_of invalid_words_metadata_class
58
+ expect(subject[invalid_words_metadata_key]).to be_a invalid_words_metadata_class
59
59
  end
60
60
  end
61
61
 
@@ -73,7 +73,7 @@ RSpec.describe LittleWeasel::Metadata::DictionaryMetadata do
73
73
  end
74
74
  end
75
75
 
76
- #init
76
+ # init
77
77
  describe '#init' do
78
78
  context 'when there are observers attached' do
79
79
  before do
@@ -94,7 +94,7 @@ RSpec.describe LittleWeasel::Metadata::DictionaryMetadata do
94
94
  it 'observers are NOT notified to init' do
95
95
  # Sanity check.
96
96
  expect(subject.count_observers).to eq 0
97
- expect(subject.observers[invalid_words_metadata_key]).to_not receive(:init)
97
+ expect(subject.observers[invalid_words_metadata_key]).not_to receive(:init)
98
98
  subject.init
99
99
  end
100
100
  end
@@ -105,7 +105,7 @@ RSpec.describe LittleWeasel::Metadata::DictionaryMetadata do
105
105
  end
106
106
  end
107
107
 
108
- #refresh
108
+ # refresh
109
109
  describe '#refresh' do
110
110
  context 'when there are observers attached' do
111
111
  before do
@@ -124,7 +124,7 @@ RSpec.describe LittleWeasel::Metadata::DictionaryMetadata do
124
124
  it 'observers are NOT notified to refresh' do
125
125
  # Sanity check.
126
126
  expect(subject.count_observers).to eq 0
127
- expect(subject.observers[invalid_words_metadata_key]).to_not receive(:refresh)
127
+ expect(subject.observers[invalid_words_metadata_key]).not_to receive(:refresh)
128
128
  subject.refresh
129
129
  end
130
130
  end
@@ -135,7 +135,7 @@ RSpec.describe LittleWeasel::Metadata::DictionaryMetadata do
135
135
  end
136
136
  end
137
137
 
138
- #delete_observer
138
+ # delete_observer
139
139
  describe '#delete_observer' do
140
140
  context 'when a valid observer object is passed' do
141
141
  before do
@@ -157,12 +157,12 @@ RSpec.describe LittleWeasel::Metadata::DictionaryMetadata do
157
157
 
158
158
  it 'raises an error' do
159
159
  expect { subject.delete_observer(bad_observer) }.to raise_error 'Argument metadata_observable is not a ' \
160
- "Metadata::MetadataObserverable object: #{bad_observer.class}"
160
+ "Metadata::MetadataObserverable object: #{bad_observer.class}"
161
161
  end
162
162
  end
163
163
  end
164
164
 
165
- #add_observers
165
+ # add_observers
166
166
  describe '#add_observers' do
167
167
  it 'returns the same object that was called' do
168
168
  expect(subject.add_observers).to be subject
@@ -29,7 +29,7 @@ RSpec.describe LittleWeasel::Metadata::InvalidWordsMetadata do
29
29
 
30
30
  let(:configuration) { LittleWeasel.configuration }
31
31
 
32
- #new
32
+ # new
33
33
  describe '#new' do
34
34
  context 'with invalid arguments' do
35
35
  subject { invalid_words_metadata }
@@ -39,7 +39,7 @@ RSpec.describe LittleWeasel::Metadata::InvalidWordsMetadata do
39
39
  end
40
40
 
41
41
  context 'with invalid dictionary metadata object' do
42
- let(:dictionary_words) { { 'a' => true, 'b' => true } }
42
+ let(:dictionary_words) { { a: true, b: true } }
43
43
  let(:dictionary_metadata_object) { :wrong_type }
44
44
 
45
45
  it 'raises an error' do
@@ -48,7 +48,7 @@ RSpec.describe LittleWeasel::Metadata::InvalidWordsMetadata do
48
48
  end
49
49
 
50
50
  context 'with invalid dictionary metadata' do
51
- let(:dictionary_words) { { 'a' => true, 'b' => true } }
51
+ let(:dictionary_words) { { a: true, b: true } }
52
52
  let(:dictionary_metadata) { :wrong_type }
53
53
 
54
54
  it 'raises an error' do
@@ -75,16 +75,16 @@ RSpec.describe LittleWeasel::Metadata::InvalidWordsMetadata do
75
75
  let(:word_results2) { create(:word_results, original_word: 'badword2') }
76
76
 
77
77
  it 'instantiates without error' do
78
- expect { subject }.to_not raise_error
78
+ expect { subject }.not_to raise_error
79
79
  end
80
80
 
81
81
  it 'initializes the necessary object attributes' do
82
- expect(subject.on?).to eq true
83
- expect(subject.off?).to eq false
82
+ expect(subject.on?).to be true
83
+ expect(subject.off?).to be false
84
84
  expect(subject.value).to eq configuration.max_invalid_words_bytesize
85
- expect(subject.value_exceeded?).to eq false
85
+ expect(subject.value_exceeded?).to be false
86
86
  expect(subject.current_invalid_word_bytesize).to eq 16
87
- expect(subject.cache_invalid_words?).to eq true
87
+ expect(subject.cache_invalid_words?).to be true
88
88
  end
89
89
  end
90
90
 
@@ -109,30 +109,30 @@ RSpec.describe LittleWeasel::Metadata::InvalidWordsMetadata do
109
109
  end
110
110
  end
111
111
 
112
- #refresh
112
+ # refresh
113
113
  describe '#refresh' do
114
114
  it 'the metadata is refreshed' do
115
115
  expect(subject.current_invalid_word_bytesize).to eq 0
116
116
  expect do
117
117
  dictionary.word_results('badword')
118
118
  subject.refresh
119
- end.to change { subject.current_invalid_word_bytesize }
120
- .from(0).to(7)
119
+ end.to change(subject, :current_invalid_word_bytesize)
120
+ .from(0).to(7)
121
121
  end
122
122
  end
123
123
 
124
- #init
124
+ # init
125
125
  describe '#init' do
126
126
  it 'the metadata is initialized' do
127
127
  expect do
128
128
  subject.dictionary_metadata_object.dictionary_words['not-found'] = false
129
129
  subject.init
130
- end.to change { subject.current_invalid_word_bytesize }
131
- .from(0).to(9)
130
+ end.to change(subject, :current_invalid_word_bytesize)
131
+ .from(0).to(9)
132
132
  end
133
133
  end
134
134
 
135
- #Update
135
+ # Update
136
136
  describe '#update' do
137
137
  context 'with an action NOT on the whitelist' do
138
138
  let(:action) { :bad_action! }
@@ -147,8 +147,8 @@ RSpec.describe LittleWeasel::Metadata::InvalidWordsMetadata do
147
147
  it 'carries out the requested action' do
148
148
  expect do
149
149
  dictionary.word_results 'not-found'
150
- end.to change { subject.current_invalid_word_bytesize }
151
- .from(0).to(9)
150
+ end.to change(subject, :current_invalid_word_bytesize)
151
+ .from(0).to(9)
152
152
  end
153
153
  end
154
154
  end
@@ -13,7 +13,7 @@ RSpec.describe LittleWeasel::Metadata::MetadataObserverable, type: :module do
13
13
 
14
14
  describe '#observe?' do
15
15
  it 'returns false by default' do
16
- expect(subject.observe?).to eq false
16
+ expect(subject.observe?).to be false
17
17
  end
18
18
  end
19
19
 
@@ -37,7 +37,7 @@ RSpec.describe LittleWeasel::Modules::DictionaryFileLoader, type: :module do
37
37
  let(:dictionary_file_key) { file }
38
38
  let(:dictionary_cache) { {} }
39
39
 
40
- #load
40
+ # load
41
41
  describe '#load' do
42
42
  context 'with an invalid dictionary file' do
43
43
  context 'when it cannot be found' do
@@ -52,7 +52,7 @@ RSpec.describe LittleWeasel::Modules::DictionaryFileLoader, type: :module do
52
52
  let(:dictionary_path) { dictionary_path_for file_name: 'empty-dictionary' }
53
53
 
54
54
  it 'raises an error' do
55
- expect { subject.load dictionary_path }.to raise_error LittleWeasel::Errors::DictionaryFileEmptyError
55
+ expect { subject.load dictionary_path }.to raise_error LittleWeasel::Errors::DictionaryFileEmptyError
56
56
  end
57
57
  end
58
58
 
@@ -64,7 +64,7 @@ RSpec.describe LittleWeasel::Modules::DictionaryFileLoader, type: :module do
64
64
  let(:dictionary_path) { language_dictionary_path language: :en }
65
65
 
66
66
  it 'raises an error' do
67
- expect { subject.load dictionary_path }.to raise_error LittleWeasel::Errors::DictionaryFileTooLargeError
67
+ expect { subject.load dictionary_path }.to raise_error LittleWeasel::Errors::DictionaryFileTooLargeError
68
68
  end
69
69
  end
70
70
  end
@@ -78,39 +78,39 @@ RSpec.describe LittleWeasel::Modules::DictionaryFileLoader, type: :module do
78
78
  before { subject }
79
79
 
80
80
  it 'does not raise an error' do
81
- expect { subject }.to_not raise_error
81
+ expect { subject }.not_to raise_error
82
82
  end
83
83
  end
84
84
 
85
85
  context 'when the dictionary is NOT already loaded/cached' do
86
86
  let(:expected_dictionary_key_key) { LittleWeasel::DictionaryKey.new(language: language, region: region, tag: tag).key }
87
87
  let(:expected_results) do
88
- ['apple',
89
- 'better',
90
- 'cat',
91
- 'dog',
92
- 'everyone',
93
- 'fat',
94
- 'game',
95
- 'help',
96
- 'italic',
97
- 'jasmine',
98
- 'kelp',
99
- 'love',
100
- 'man',
101
- 'nope',
102
- 'octopus',
103
- 'popeye',
104
- 'queue',
105
- 'ruby',
106
- 'stop',
107
- 'top',
108
- 'ultimate',
109
- 'very',
110
- 'was',
111
- 'xylophone',
112
- 'yes',
113
- 'zebra']
88
+ %w[apple
89
+ better
90
+ cat
91
+ dog
92
+ everyone
93
+ fat
94
+ game
95
+ help
96
+ italic
97
+ jasmine
98
+ kelp
99
+ love
100
+ man
101
+ nope
102
+ octopus
103
+ popeye
104
+ queue
105
+ ruby
106
+ stop
107
+ top
108
+ ultimate
109
+ very
110
+ was
111
+ xylophone
112
+ yes
113
+ zebra]
114
114
  end
115
115
 
116
116
  it 'returns an Array of dictionary words loaded from the file' do
@@ -18,63 +18,63 @@ RSpec.describe LittleWeasel::Modules::DictionarySourceable, type: :module do
18
18
  let(:dictionary_memory_source) { described_class.memory_source }
19
19
  let(:dictionary_file_source) { language_dictionary_path language: :en }
20
20
 
21
- #.MEMORY_SOURCE
21
+ # .MEMORY_SOURCE
22
22
  describe '::MEMORY_SOURCE' do
23
23
  it 'returns the memory source prefix' do
24
24
  expect(described_class::MEMORY_SOURCE).to eq '*'
25
25
  end
26
26
  end
27
27
 
28
- #.memory_source
28
+ # .memory_source
29
29
  describe '.memory_source' do
30
30
  it 'returns a new memory source' do
31
31
  expect(described_class.memory_source).to be_truthy
32
32
  end
33
33
  end
34
34
 
35
- #.file_source?
35
+ # .file_source?
36
36
  describe '.file_source?' do
37
37
  context 'when dictionary_source is a file source' do
38
38
  it 'returns truthy' do
39
- expect(described_class.file_source? dictionary_file_source).to be_truthy
39
+ expect(described_class).to be_file_source(dictionary_file_source)
40
40
  end
41
41
  end
42
42
 
43
43
  context 'when dictionary_source is NOT a file source' do
44
44
  it 'returns falsey' do
45
- expect(described_class.file_source? dictionary_memory_source).to be_falsey
45
+ expect(described_class).not_to be_file_source(dictionary_memory_source)
46
46
  end
47
47
  end
48
48
  end
49
49
 
50
- #.memory_source?
50
+ # .memory_source?
51
51
  describe '.memory_source?' do
52
52
  context 'when dictionary_source is a memory source' do
53
53
  it 'returns truthy if argument is a valid memory source' do
54
- expect(described_class.memory_source? '*12345678').to be_truthy
55
- expect(described_class.memory_source? '*abcdef00').to be_truthy
56
- expect(described_class.memory_source? '*ABCDEF00').to be_truthy
57
- expect(described_class.memory_source? '*aBcDeF00').to be_truthy
54
+ expect(described_class).to be_memory_source('*12345678')
55
+ expect(described_class).to be_memory_source('*abcdef00')
56
+ expect(described_class).to be_memory_source('*ABCDEF00')
57
+ expect(described_class).to be_memory_source('*aBcDeF00')
58
58
  end
59
59
 
60
60
  it 'returns falsey if argument is NOT a memory source' do
61
- expect(described_class.memory_source? '*123456789').to be_falsey
62
- expect(described_class.memory_source? '*abcdefg0').to be_falsey
63
- expect(described_class.memory_source? '*ABCDEFG0').to be_falsey
64
- expect(described_class.memory_source? '*aBcDeFg0').to be_falsey
65
- expect(described_class.memory_source? '$12345678').to be_falsey
61
+ expect(described_class).not_to be_memory_source('*123456789')
62
+ expect(described_class).not_to be_memory_source('*abcdefg0')
63
+ expect(described_class).not_to be_memory_source('*ABCDEFG0')
64
+ expect(described_class).not_to be_memory_source('*aBcDeFg0')
65
+ expect(described_class).not_to be_memory_source('$12345678')
66
66
 
67
- expect(described_class.memory_source? '123456789').to be_falsey
68
- expect(described_class.memory_source? 'abcdefg0').to be_falsey
69
- expect(described_class.memory_source? 'ABCDEFG0').to be_falsey
70
- expect(described_class.memory_source? 'aBcDeFg0').to be_falsey
71
- expect(described_class.memory_source? '123456789').to be_falsey
67
+ expect(described_class).not_to be_memory_source('123456789')
68
+ expect(described_class).not_to be_memory_source('abcdefg0')
69
+ expect(described_class).not_to be_memory_source('ABCDEFG0')
70
+ expect(described_class).not_to be_memory_source('aBcDeFg0')
71
+ expect(described_class).not_to be_memory_source('123456789')
72
72
  end
73
73
  end
74
74
 
75
75
  context 'when dictionary_source is a file source' do
76
76
  it 'returns falsey' do
77
- expect(described_class.memory_source? dictionary_file_source).to be_falsey
77
+ expect(described_class).not_to be_memory_source(dictionary_file_source)
78
78
  end
79
79
  end
80
80
  end
@@ -23,24 +23,24 @@ RSpec.describe LittleWeasel::Modules::Language, type: :module do
23
23
 
24
24
  let(:language) {}
25
25
 
26
- #language?
26
+ # language?
27
27
  describe '#language?' do
28
28
  context 'when language is present?' do
29
29
  let(:language) { :es }
30
30
 
31
31
  it 'returns true' do
32
- expect(subject.language?).to eq true
32
+ expect(subject.language?).to be true
33
33
  end
34
34
  end
35
35
 
36
36
  context 'when language is NOT present?' do
37
37
  it 'returns false' do
38
- expect(subject.language?).to eq false
38
+ expect(subject.language?).to be false
39
39
  end
40
40
  end
41
41
  end
42
42
 
43
- #normalize_language!
43
+ # normalize_language!
44
44
  describe '#normalize_language!' do
45
45
  context 'when language is present?' do
46
46
  context 'when language responds to #upcase!' do
@@ -75,7 +75,7 @@ RSpec.describe LittleWeasel::Modules::Language, type: :module do
75
75
  end
76
76
  end
77
77
 
78
- #.normalize_language
78
+ # .normalize_language
79
79
  describe '#.normalize_language' do
80
80
  context 'with a non-nil language' do
81
81
  context 'when passing a Symbol' do
@@ -25,7 +25,7 @@ RSpec.describe LittleWeasel::Modules::Locale, type: :module do
25
25
  let(:language) {}
26
26
  let(:region) {}
27
27
 
28
- #locale
28
+ # locale
29
29
  describe '#locale' do
30
30
  context 'with valid arguments' do
31
31
  context 'with valid language' do
@@ -23,24 +23,24 @@ RSpec.describe LittleWeasel::Modules::Region, type: :module do
23
23
 
24
24
  let(:region) {}
25
25
 
26
- #region?
26
+ # region?
27
27
  describe '#region?' do
28
28
  context 'when region is present?' do
29
29
  let(:region) { :es }
30
30
 
31
31
  it 'returns true' do
32
- expect(subject.region?).to eq true
32
+ expect(subject.region?).to be true
33
33
  end
34
34
  end
35
35
 
36
36
  context 'when region is NOT present?' do
37
37
  it 'returns false' do
38
- expect(subject.region?).to eq false
38
+ expect(subject.region?).to be false
39
39
  end
40
40
  end
41
41
  end
42
42
 
43
- #normalize_region!
43
+ # normalize_region!
44
44
  describe '#normalize_region!' do
45
45
  context 'when region is present?' do
46
46
  context 'when region responds to #upcase' do
@@ -75,7 +75,7 @@ RSpec.describe LittleWeasel::Modules::Region, type: :module do
75
75
  end
76
76
  end
77
77
 
78
- #.normalize_region
78
+ # .normalize_region
79
79
  describe '#.normalize_region' do
80
80
  context 'with a non-nil region' do
81
81
  context 'when passing a Symbol' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # frozen_string_literals: true
2
4
 
3
5
  require 'spec_helper'
@@ -5,10 +7,10 @@ require 'spec_helper'
5
7
  RSpec.describe LittleWeasel::Preprocessors::EnUs::CapitalizePreprocessor do
6
8
  subject { described_class.new }
7
9
 
8
- #.new
10
+ # .new
9
11
  describe '.new' do
10
12
  it 'instantiates the object' do
11
- expect { subject }.to_not raise_error
13
+ expect { subject }.not_to raise_error
12
14
  end
13
15
 
14
16
  describe '#order' do
@@ -19,16 +21,16 @@ RSpec.describe LittleWeasel::Preprocessors::EnUs::CapitalizePreprocessor do
19
21
 
20
22
  describe '#preprocessor_on' do
21
23
  it 'sets #preprocessor_on to true by default' do
22
- expect(subject.preprocessor_on).to eq true
24
+ expect(subject.preprocessor_on).to be true
23
25
  end
24
26
  end
25
27
  end
26
28
 
27
- #.preprocess
29
+ # .preprocess
28
30
  describe '.preprocess' do
29
31
  it 'processes and capitalizes the word' do
30
- expect(described_class.preprocess 'wOrD').to eq [true, 'Word']
31
- expect(described_class.preprocess 'Word').to eq [true, 'Word']
32
+ expect(described_class.preprocess('wOrD')).to eq [true, 'Word']
33
+ expect(described_class.preprocess('Word')).to eq [true, 'Word']
32
34
  end
33
35
  end
34
36
  end
@@ -19,7 +19,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWord do
19
19
  let(:preprocessed) { true }
20
20
  let(:preprocessor_order) { :preprocessor_order }
21
21
 
22
- #.new
22
+ # .new
23
23
  describe '.new' do
24
24
  context 'initializes the attributes' do
25
25
  describe '#original_word' do
@@ -89,7 +89,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWord do
89
89
  describe '#preprocessed?' do
90
90
  context 'when preprocessed is true' do
91
91
  it 'returns true' do
92
- expect(subject.preprocessed?).to eq true
92
+ expect(subject.preprocessed?).to be true
93
93
  end
94
94
  end
95
95
 
@@ -97,7 +97,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWord do
97
97
  let(:preprocessed) { false }
98
98
 
99
99
  it 'returns false' do
100
- expect(subject.preprocessed?).to eq false
100
+ expect(subject.preprocessed?).to be false
101
101
  end
102
102
  end
103
103
  end
@@ -27,21 +27,22 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
27
27
  end
28
28
  let(:original_word) { 'word' }
29
29
  let(:preprocessed) { true }
30
- let(:preprocessed_word) { 'preprocessed-word0'}
30
+ let(:preprocessed_word) { 'preprocessed-word0' }
31
31
  let(:preprocessor) { :preprocesor0 }
32
32
  let(:preprocessor_order) { 0 }
33
33
 
34
- #.validate_prepreprocessed_word
34
+ # .validate_prepreprocessed_word
35
35
  describe '.validate_prepreprocessed_word' do
36
36
  context 'when the object is valid' do
37
37
  it 'does not raise an error' do
38
- expect { PreprocessedWordValidatable.validate_prepreprocessed_word(preprocessed_word: preprocessed_word_object) }.to_not raise_error
38
+ expect { PreprocessedWordValidatable.validate_prepreprocessed_word(preprocessed_word: preprocessed_word_object) }.not_to raise_error
39
39
  end
40
40
  end
41
41
 
42
42
  context 'when the object is INVALID' do
43
43
  context 'when #original_word is missing' do
44
44
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
45
+
45
46
  let(:method) { :original_word }
46
47
 
47
48
  it 'raises an eror' do
@@ -51,6 +52,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
51
52
 
52
53
  context 'when #original_word= is missing' do
53
54
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
55
+
54
56
  let(:method) { :original_word= }
55
57
 
56
58
  it 'raises an eror' do
@@ -60,6 +62,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
60
62
 
61
63
  context 'when #preprocessed_word is missing' do
62
64
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
65
+
63
66
  let(:method) { :preprocessed_word }
64
67
 
65
68
  it 'raises an eror' do
@@ -69,6 +72,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
69
72
 
70
73
  context 'when #preprocessed_word= is missing' do
71
74
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
75
+
72
76
  let(:method) { :preprocessed_word= }
73
77
 
74
78
  it 'raises an eror' do
@@ -78,6 +82,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
78
82
 
79
83
  context 'when #preprocessed is missing' do
80
84
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
85
+
81
86
  let(:method) { :preprocessed }
82
87
 
83
88
  it 'raises an eror' do
@@ -87,6 +92,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
87
92
 
88
93
  context 'when #preprocessed= is missing' do
89
94
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
95
+
90
96
  let(:method) { :preprocessed= }
91
97
 
92
98
  it 'raises an eror' do
@@ -96,6 +102,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
96
102
 
97
103
  context 'when #preprocessed? is missing' do
98
104
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
105
+
99
106
  let(:method) { :preprocessed? }
100
107
 
101
108
  it 'raises an eror' do
@@ -105,6 +112,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
105
112
 
106
113
  context 'when #preprocessor is missing' do
107
114
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
115
+
108
116
  let(:method) { :preprocessor }
109
117
 
110
118
  it 'raises an eror' do
@@ -114,6 +122,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
114
122
 
115
123
  context 'when #preprocessor= is missing' do
116
124
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
125
+
117
126
  let(:method) { :preprocessor= }
118
127
 
119
128
  it 'raises an eror' do
@@ -123,6 +132,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
123
132
 
124
133
  context 'when #preprocessor_order is missing' do
125
134
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
135
+
126
136
  let(:method) { :preprocessor_order }
127
137
 
128
138
  it 'raises an eror' do
@@ -132,6 +142,7 @@ RSpec.describe LittleWeasel::Preprocessors::PreprocessedWordValidatable, type: :
132
142
 
133
143
  context 'when #preprocessor_order= is missing' do
134
144
  before { allow(preprocessed_word_object).to receive(:respond_to?).with(method).and_return(false) }
145
+
135
146
  let(:method) { :preprocessor_order= }
136
147
 
137
148
  it 'raises an eror' do