zenlish 0.2.06 → 0.2.07

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/.rubocop.yml +48 -275
  3. data/CHANGELOG.md +8 -0
  4. data/LICENSE.txt +1 -1
  5. data/lib/zenlish/feature/feature_struct_def.rb +0 -2
  6. data/lib/zenlish/inflect/output_expression.rb +4 -0
  7. data/lib/zenlish/version.rb +1 -1
  8. data/lib/zenlish/wclasses/irregular_verb_extension.rb +0 -1
  9. data/lib/zenlish.rb +3 -3
  10. data/spec/zenlish/feature/boolean_domain_spec.rb +14 -14
  11. data/spec/zenlish/feature/boolean_value_spec.rb +6 -5
  12. data/spec/zenlish/feature/enumeration_domain_spec.rb +16 -16
  13. data/spec/zenlish/feature/feature_def_spec.rb +15 -14
  14. data/spec/zenlish/feature/feature_spec.rb +16 -16
  15. data/spec/zenlish/feature/feature_struct_def_bearer_spec.rb +16 -16
  16. data/spec/zenlish/feature/feature_struct_def_spec.rb +23 -23
  17. data/spec/zenlish/feature/identifier_domain_spec.rb +12 -12
  18. data/spec/zenlish/feature/identifier_value_spec.rb +6 -5
  19. data/spec/zenlish/feature/symbol_value_spec.rb +6 -5
  20. data/spec/zenlish/inflect/concatenation_spec.rb +8 -8
  21. data/spec/zenlish/inflect/equals_literal_spec.rb +17 -16
  22. data/spec/zenlish/inflect/feature_heading_spec.rb +14 -13
  23. data/spec/zenlish/inflect/formal_argument_spec.rb +5 -5
  24. data/spec/zenlish/inflect/function_call_spec.rb +8 -9
  25. data/spec/zenlish/inflect/inflection_rule_spec.rb +20 -20
  26. data/spec/zenlish/inflect/inflection_table_builder_spec.rb +37 -37
  27. data/spec/zenlish/inflect/inflection_table_spec.rb +33 -32
  28. data/spec/zenlish/inflect/input_asis_spec.rb +10 -9
  29. data/spec/zenlish/inflect/literal_asis_spec.rb +7 -7
  30. data/spec/zenlish/inflect/matches_pattern_spec.rb +15 -14
  31. data/spec/zenlish/inflect/membership_spec.rb +16 -15
  32. data/spec/zenlish/inflect/method_heading_spec.rb +12 -11
  33. data/spec/zenlish/inflect/not_equals_literal_spec.rb +17 -16
  34. data/spec/zenlish/inflect/substitution_spec.rb +9 -10
  35. data/spec/zenlish/inflect/unconditionally_true_spec.rb +7 -5
  36. data/spec/zenlish/lang/dictionary_spec.rb +17 -19
  37. data/spec/zenlish/lang/lemmatizer_spec.rb +23 -23
  38. data/spec/zenlish/lang/zenlish_grammar_spec.rb +3 -3
  39. data/spec/zenlish/lex/empty_lexicon_factory_spec.rb +8 -8
  40. data/spec/zenlish/lex/lexeme_spec.rb +18 -18
  41. data/spec/zenlish/lex/lexical_entry_spec.rb +14 -13
  42. data/spec/zenlish/lex/lexicon_spec.rb +44 -43
  43. data/spec/zenlish/lex/literal_spec.rb +6 -6
  44. data/spec/zenlish/lexer/lexer_spec.rb +10 -10
  45. data/spec/zenlish/parser/lesson1_spec.rb +79 -79
  46. data/spec/zenlish/parser/lesson2_spec.rb +102 -102
  47. data/spec/zenlish/parser/lesson3_spec.rb +89 -89
  48. data/spec/zenlish/parser/zparser_spec.rb +6 -6
  49. data/spec/zenlish/support/var2word.rb +0 -2
  50. data/spec/zenlish/trie/base_trie_node_spec.rb +11 -11
  51. data/spec/zenlish/trie/trie_spec.rb +46 -46
  52. data/spec/zenlish/wclasses/common_noun_spec.rb +9 -9
  53. data/spec/zenlish/wclasses/demonstrative_determiner_spec.rb +11 -11
  54. data/spec/zenlish/wclasses/irregular_verb_can_spec.rb +10 -10
  55. data/spec/zenlish/wclasses/irregular_verb_extension_spec.rb +10 -10
  56. data/spec/zenlish/wclasses/irregular_verb_spec.rb +19 -19
  57. data/spec/zenlish/wclasses/lexical_verb_spec.rb +7 -7
  58. data/spec/zenlish/wclasses/modal_verb_can_spec.rb +9 -9
  59. data/spec/zenlish/wclasses/noun_spec.rb +7 -7
  60. data/spec/zenlish/wclasses/personal_pronoun_spec.rb +15 -15
  61. data/spec/zenlish/wclasses/possessive_determiner_spec.rb +15 -15
  62. data/spec/zenlish/wclasses/preposition_spec.rb +5 -5
  63. data/spec/zenlish/wclasses/proper_noun_spec.rb +3 -3
  64. data/spec/zenlish/wclasses/regular_verb_spec.rb +12 -12
  65. data/spec/zenlish/wclasses/regular_verb_want_spec.rb +7 -7
  66. data/spec/zenlish/wclasses/verb_spec.rb +9 -9
  67. data/spec/zenlish_spec.rb +1 -1
  68. data/zenlish.gemspec +6 -5
  69. metadata +32 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdf6f9fd05062b835014ce5f3a44c2a7ec1341961184dd71086216b9b138fc8a
4
- data.tar.gz: dc4c8ee3f0dfbb7783e9ee2686da0483d4edd2de5aeea727c0694a24d4dd4e7d
3
+ metadata.gz: 4a977fc6ec2982826186dd5f45b38e2394680d1827ba50b525650c2a9804daa5
4
+ data.tar.gz: be6b8cc9f1d842ff970202854de9baeb86ca35d1548f6331b85438dcd1791f05
5
5
  SHA512:
6
- metadata.gz: 9b407a9bb5402dfee5ab8063c8f8c01e0e75c083c6594527116368d5ea65d06c5830ce4fb6d52310743f085114a40f5959750f774001815e49c318f6cd0a42b5
7
- data.tar.gz: d26b3d2679b94b359ff54c2a7d591485cf47e651404f77dc09cde42d6974815c1dacbc278416b0ad0995bddd1d09017c686a96f2d3c5c1862620840ee9976c71
6
+ metadata.gz: c961a939f20fc20123e07a87156cf58d1fa772713ba75f2ab106e151b45b18ec8812d2860b9dd8dc133bab496de14e551e24ebc76e91de03d9e002d875b531d5
7
+ data.tar.gz: 2e00f8de8768339a8b03a9ebeb95a828761b429f10dba844ab5fea78873c3f05a1d32a14d2caa0d81a1096a3a34378a1ac971e81d80e4dc1cde44fdda266112a
data/.rubocop.yml CHANGED
@@ -1,9 +1,12 @@
1
1
  AllCops:
2
2
  Exclude:
3
3
  - 'exp/**/*'
4
+ - 'demo/**/*'
5
+ NewCops: enable
6
+ SuggestExtensions: false
4
7
 
5
- Gemspec/DateAssignment:
6
- Enabled: true
8
+ Gemspec/DevelopmentDependencies:
9
+ EnforcedStyle: gemspec
7
10
 
8
11
  Layout/ArgumentAlignment:
9
12
  Enabled: false
@@ -49,115 +52,13 @@ Layout/IndentationConsistency:
49
52
  Layout/HeredocIndentation:
50
53
  Enabled: false
51
54
 
52
- Layout/LineEndStringConcatenationIndentation:
53
- Enabled: true
54
-
55
- Layout/MultilineHashBraceLayout:
56
- Enabled: true
57
-
58
55
  Layout/MultilineMethodCallBraceLayout:
59
56
  Enabled: true
60
57
  EnforcedStyle: same_line
61
58
 
62
- Layout/SpaceAroundOperators:
63
- Enabled: true
64
-
65
- Layout/SpaceBeforeBrackets:
66
- Enabled: true
67
-
68
- Layout/SpaceInsideParens:
69
- Enabled: true
70
-
71
- Layout/IndentationStyle:
72
- Enabled: true
73
-
74
- Layout/SpaceAroundMethodCallOperator:
75
- Enabled: true
76
-
77
- Layout/TrailingEmptyLines:
78
- Enabled: true
79
-
80
- Layout/TrailingWhitespace:
81
- Enabled: true
82
-
83
- Lint/AmbiguousAssignment:
84
- Enabled: true
85
-
86
- Lint/AmbiguousRange:
87
- Enabled: true
88
-
89
- Lint/DeprecatedConstants:
90
- Enabled: true
91
-
92
- Lint/DuplicateBranch:
93
- Enabled: true
94
-
95
- Lint/DuplicateRegexpCharacterClassElement:
96
- Enabled: true
97
-
98
- Lint/EmptyBlock:
99
- Enabled: true
100
-
101
- Lint/EmptyClass:
102
- Enabled: false
103
-
104
- Lint/EmptyInPattern:
105
- Enabled: true
106
-
107
- Lint/LambdaWithoutLiteralBlock:
108
- Enabled: true
109
-
110
- Lint/Loop:
111
- Enabled: true
112
-
113
- Lint/NoReturnInBeginEndBlocks:
114
- Enabled: true
115
-
116
- Lint/NumberedParameterAssignment:
117
- Enabled: true
118
-
119
- Lint/OrAssignmentToConstant:
120
- Enabled: true
121
-
122
- Lint/RaiseException:
123
- Enabled: true
124
-
125
- Lint/RedundantDirGlobSort:
126
- Enabled: true
127
-
128
- Lint/RescueException:
129
- Enabled: true
130
-
131
- Lint/StructNewOverride:
132
- Enabled: true
133
-
134
- Lint/SymbolConversion:
135
- Enabled: true
136
-
137
- Lint/ToEnumArguments:
138
- Enabled: true
139
-
140
- Lint/TripleQuotes:
141
- Enabled: true
142
-
143
- Lint/UnexpectedBlockArity:
144
- Enabled: true
145
-
146
- Lint/UnmodifiedReduceAccumulator:
147
- Enabled: true
148
-
149
- Lint/UnusedMethodArgument:
150
- Enabled: true
151
-
152
- Lint/UselessAccessModifier:
153
- Enabled: true
154
-
155
59
  Lint/Void:
156
60
  Enabled: false
157
61
 
158
- Lint/UselessAssignment:
159
- Enabled: true
160
-
161
62
  Metrics/AbcSize:
162
63
  Enabled: false
163
64
 
@@ -191,18 +92,16 @@ Metrics/ModuleLength:
191
92
  Metrics/PerceivedComplexity:
192
93
  Enabled: false
193
94
 
95
+ Naming/BlockForwarding:
96
+ EnforcedStyle: explicit
97
+ BlockForwardingName: aBlock
98
+
194
99
  Naming/ConstantName:
195
100
  Enabled: false
196
101
 
197
102
  Naming/ClassAndModuleCamelCase:
198
103
  Enabled: false
199
104
 
200
- Naming/BlockParameterName:
201
- Enabled: true
202
-
203
- Naming/InclusiveLanguage:
204
- Enabled: true
205
-
206
105
  Naming/MethodParameterName:
207
106
  Enabled: false
208
107
 
@@ -212,15 +111,6 @@ Naming/MethodName:
212
111
  Naming/VariableName:
213
112
  Enabled: false
214
113
 
215
- Style/AccessorGrouping:
216
- Enabled: false
217
-
218
- Style/Alias:
219
- Enabled: true
220
-
221
- Style/ArgumentsForwarding:
222
- Enabled: true
223
-
224
114
  Style/AsciiComments:
225
115
  Enabled: false
226
116
 
@@ -239,9 +129,6 @@ Style/ClassCheck:
239
129
  Style/ClassVars:
240
130
  Enabled: false
241
131
 
242
- Style/CollectionCompact:
243
- Enabled: true
244
-
245
132
  Style/ColonMethodCall:
246
133
  Enabled: false
247
134
 
@@ -254,85 +141,36 @@ Style/CommentedKeyword:
254
141
  Style/ConditionalAssignment:
255
142
  Enabled: false
256
143
 
257
- Style/DefWithParentheses:
258
- Enabled: true
259
-
260
144
  Style/Documentation:
261
145
  Enabled: false
262
146
 
263
- Style/DocumentDynamicEvalDefinition:
264
- Enabled: false
265
-
266
- Style/EmptyElse:
267
- Enabled: true
268
- EnforcedStyle: empty
269
-
270
147
  Style/ExpandPathArguments:
271
148
  Enabled: false
272
149
 
273
- Style/ExponentialNotation:
274
- Enabled: true
275
-
276
150
  Style/GuardClause:
277
151
  Enabled: false
278
152
 
279
- Style/HashEachMethods:
280
- Enabled: true
281
-
282
- Style/HashExcept:
283
- Enabled: true
284
-
285
- Style/HashTransformKeys:
286
- Enabled: true
287
-
288
- Style/HashTransformValues:
289
- Enabled: true
290
-
291
153
  Style/IfUnlessModifier:
292
154
  Enabled: false
293
155
 
294
- Style/InPatternThen:
295
- Enabled: true
296
-
297
156
  Style/InverseMethods:
298
157
  Enabled: false
299
158
 
300
159
  Style/MissingRespondToMissing:
301
160
  Enabled: false
302
161
 
303
- Style/MultilineInPatternThen:
304
- Enabled: true
305
-
306
- Style/NegatedIfElseCondition:
307
- Enabled: true
308
-
309
162
  Style/Next:
310
163
  Enabled: false
311
164
 
312
- Style/NilLambda:
313
- Enabled: true
314
-
315
165
  Style/NumericLiterals:
316
166
  Enabled: false
317
167
 
318
168
  Style/QuotedSymbols:
319
169
  Enabled: true
320
170
 
321
- Style/RaiseArgs:
322
- Enabled: true
323
-
324
- Style/RedundantArgument:
325
- Enabled: true
326
-
327
171
  Style/RedundantReturn:
328
172
  Enabled: false
329
173
 
330
- Style/RedundantSelf:
331
- Enabled: true
332
-
333
- Style/RedundantSelfAssignmentBranch:
334
- Enabled: true
335
-
336
174
  Style/RegexpLiteral:
337
175
  Enabled: false
338
176
 
@@ -342,11 +180,9 @@ Style/PercentLiteralDelimiters:
342
180
  Style/StderrPuts:
343
181
  Enabled: false
344
182
 
345
- Style/StringLiterals:
346
- Enabled: true
347
-
348
- Style/SwapValues:
349
- Enabled: true
183
+ # Calling super is mandatory for WClass subclasses, therefore we disable this cop
184
+ Style/SuperArguments:
185
+ Enabled: false
350
186
 
351
187
  Style/TernaryParentheses:
352
188
  Enabled: false
@@ -354,102 +190,39 @@ Style/TernaryParentheses:
354
190
  Style/UnlessElse:
355
191
  Enabled: false
356
192
 
357
- # Rubocop complains when it doesn't find an explicit setting for the following cops:
358
- Layout/EmptyLinesAroundAttributeAccessor:
359
- Enabled: true
360
-
361
- Lint/BinaryOperatorWithIdenticalOperands:
362
- Enabled: true
363
-
364
- Lint/DeprecatedOpenSSLConstant:
365
- Enabled: true
366
-
367
- Lint/DuplicateElsifCondition:
368
- Enabled: true
369
-
370
- Lint/DuplicateRescueException:
371
- Enabled: true
372
-
373
- Lint/EmptyConditionalBody:
374
- Enabled: true
375
-
376
- Lint/FloatComparison:
377
- Enabled: true
378
-
379
- Lint/MissingSuper:
380
- Enabled: true
381
-
382
- Lint/MixedRegexpCaptureTypes:
383
- Enabled: true
384
-
385
- Lint/OutOfRangeRegexpRef:
386
- Enabled: true
387
-
388
- Lint/SelfAssignment:
389
- Enabled: true
390
-
391
- Lint/TopLevelReturnWithArgument:
392
- Enabled: true
393
-
394
- Lint/UnreachableLoop:
395
- Enabled: true
396
-
397
- Style/ArrayCoercion:
398
- Enabled: true
399
-
400
- Style/BisectedAttrAccessor:
401
- Enabled: true
402
-
403
- Style/CaseLikeIf:
404
- Enabled: true
405
-
406
- Style/EndlessMethod:
407
- Enabled: true
408
-
409
- Style/ExplicitBlockArgument:
410
- Enabled: true
411
-
412
- Style/GlobalStdStream:
413
- Enabled: true
414
-
415
- Style/HashAsLastArrayItem:
416
- Enabled: true
417
-
418
- Style/HashConversion:
419
- Enabled: true
420
-
421
- Style/HashLikeCase:
422
- Enabled: true
423
-
424
- Style/IfWithBooleanLiteralBranches:
425
- Enabled: true
426
-
427
- Style/OptionalBooleanParameter:
428
- Enabled: true
429
-
430
- Style/RedundantAssignment:
431
- Enabled: true
432
-
433
- Style/RedundantFetchBlock:
434
- Enabled: true
435
-
436
- Style/RedundantFileExtensionInRequire:
437
- Enabled: true
438
-
439
- Style/RedundantRegexpCharacterClass:
440
- Enabled: true
441
-
442
- Style/RedundantRegexpEscape:
443
- Enabled: true
444
-
445
- Style/SingleArgumentDig:
446
- Enabled: true
447
-
448
- Style/SlicingWithRange:
449
- Enabled: true
450
-
451
- Style/StringChars:
452
- Enabled: true
453
-
454
- Style/StringConcatenation:
455
- Enabled: true
193
+ # Optional rubocop-rspec plugin rule checking
194
+ #RSpec/ContextWording:
195
+ # Enabled: false
196
+ #
197
+ #RSpec/DescribeClass:
198
+ # Enabled: false
199
+ #
200
+ #RSpec/EmptyExampleGroup:
201
+ # Enabled: false
202
+ #
203
+ #RSpec/ExampleLength:
204
+ # Max: 60
205
+ #
206
+ #RSpec/IndexedLet:
207
+ # Enabled: false
208
+ #
209
+ #RSpec/MultipleExpectations:
210
+ # Max: 25
211
+ #
212
+ #RSpec/MultipleMemoizedHelpers:
213
+ # Max: 35
214
+ #
215
+ #RSpec/NoExpectationExample:
216
+ # Enabled: false
217
+ #
218
+ #RSpec/RepeatedDescription:
219
+ # Enabled: false
220
+ #
221
+ #RSpec/RepeatedExample:
222
+ # Enabled: false
223
+ #
224
+ #RSpec/RepeatedExampleGroupDescription:
225
+ # Enabled: false
226
+ #
227
+ #RSpec/VerifiedDoubles:
228
+ # Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
  # CHANGELOG
2
+ ## [0.2.07] - 2025-04-03
3
+ Minor changes
4
+
5
+ ### Changed
6
+ - File `zenlish.gempsec` updated versions in depedencies
7
+ - Code re-styling to please `Rubocop` 1.75.1
8
+ - Spec files re-styling to please `rubocop-rspec` 3.5.0
9
+
2
10
  ## [0.2.06] - 2021-09-04
3
11
  - Fixes and code re-styling to please `Rubocop` 1.19.1
4
12
 
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019-2020, Dimitri Geshef
3
+ Copyright (c) 2019-2025, Dimitri Geshef
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -39,8 +39,6 @@ module Zenlish
39
39
  aParent
40
40
  elsif aParent
41
41
  aParent.struct
42
- else
43
- nil
44
42
  end
45
43
  end
46
44
  end # class
@@ -2,7 +2,11 @@
2
2
 
3
3
  module Zenlish
4
4
  module Inflect
5
+ # rubocop: disable Lint/EmptyClass
6
+
5
7
  class OutputExpression
6
8
  end # class
9
+
10
+ # rubocop: enable Lint/EmptyClass
7
11
  end # module
8
12
  end # module
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zenlish
4
- VERSION = '0.2.06'
4
+ VERSION = '0.2.07'
5
5
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'lexical_verb'
4
- require_relative 'irregular_verb_extension'
5
4
 
6
5
  module Zenlish
7
6
  module WClasses
data/lib/zenlish.rb CHANGED
@@ -3,8 +3,8 @@
3
3
  # This file acts as a jumping-off point for loading dependencies expected
4
4
  # for a Zenlish client.
5
5
 
6
- require_relative './zenlish/version'
7
- require_relative './zenlish/lang/dictionary'
8
- require_relative './zenlish/parser/zparser'
6
+ require_relative 'zenlish/version'
7
+ require_relative 'zenlish/lang/dictionary'
8
+ require_relative 'zenlish/parser/zparser'
9
9
 
10
10
  # End of file
@@ -5,34 +5,34 @@ require_relative '../../../lib/zenlish/feature/boolean_domain' # Load the class
5
5
  module Zenlish
6
6
  module Feature
7
7
  describe BooleanDomain do
8
- subject { BooleanDomain.instance }
8
+ subject(:bool_dom) { described_class.instance }
9
9
 
10
10
  context 'Initialization:' do
11
- it 'should be initialized without argument' do
12
- expect { BooleanDomain.instance }.not_to raise_error
11
+ it 'is initialized without argument' do
12
+ expect { described_class.instance }.not_to raise_error
13
13
  end
14
14
  end # context
15
15
 
16
16
  context 'Provided services:' do
17
- it 'should know whether a value is in domain' do
18
- expect(subject.include?('invalid')).to be_falsey
19
- expect(subject.include?(true)).to be_truthy
20
- expect(subject.include?(false)).to be_truthy
17
+ it 'knows whether a value is in domain' do
18
+ expect(bool_dom).not_to include('invalid')
19
+ expect(bool_dom).to include(true)
20
+ expect(bool_dom).to include(false)
21
21
  end
22
22
 
23
- it 'should provide a factory method for boolean values' do
24
- expect(subject.build_value(true)).to be_kind_of(BooleanValue)
25
- expect(subject.build_value(false)).to be_kind_of(BooleanValue)
23
+ it 'provides a factory method for boolean values' do
24
+ expect(bool_dom.build_value(true)).to be_a(BooleanValue)
25
+ expect(bool_dom.build_value(false)).to be_a(BooleanValue)
26
26
  end
27
27
 
28
- it 'should return all valid values in domain when requested' do
29
- expect(subject.to_a).to eq([false, true])
28
+ it 'returns all valid values in domain when requested' do
29
+ expect(bool_dom.to_a).to eq([false, true])
30
30
  end
31
31
 
32
- it 'should complain when asked to build a non-boolean value' do
32
+ it 'complains when asked to build a non-boolean value' do
33
33
  err = StandardError
34
34
  err_msg = 'Expected a boolean instead of String.'
35
- expect { subject.build_value('?') }.to raise_error(err, err_msg)
35
+ expect { bool_dom.build_value('?') }.to raise_error(err, err_msg)
36
36
  end
37
37
  end # context
38
38
  end # describe
@@ -7,15 +7,16 @@ module Zenlish
7
7
  module Feature
8
8
  describe BooleanValue do
9
9
  let(:its_value) { false }
10
- subject { BooleanValue.new(its_value) }
10
+
11
+ subject(:boolean) { described_class.new(its_value) }
11
12
 
12
13
  context 'Initialization:' do
13
- it 'should be initialized with a value argument' do
14
- expect { BooleanValue.new(its_value) }.not_to raise_error
14
+ it 'is initialized with a value argument' do
15
+ expect { described_class.new(its_value) }.not_to raise_error
15
16
  end
16
17
 
17
- it 'should know its internal value' do
18
- expect(subject.val.class).to eq(FalseClass)
18
+ it 'knows its internal value' do
19
+ expect(boolean.val.class).to eq(FalseClass)
19
20
  end
20
21
  end # context
21
22
 
@@ -6,39 +6,39 @@ require_relative '../../../lib/zenlish/feature/enumeration_domain'
6
6
  module Zenlish
7
7
  module Feature
8
8
  describe EnumerationDomain do
9
- subject { EnumerationDomain.new(:singular, :plural) }
9
+ subject(:enumeration) { described_class.new(:singular, :plural) }
10
10
 
11
11
  context 'Initialization:' do
12
- it 'should be initialized with arguments' do
13
- expect { EnumerationDomain.new(:singular, :plural) }.not_to raise_error
12
+ it 'is initialized with arguments' do
13
+ expect { described_class.new(:singular, :plural) }.not_to raise_error
14
14
  end
15
15
 
16
- it 'should know the values of enumeration' do
17
- expect(subject.enum).to eq(%i[singular plural])
16
+ it 'knows the values of enumeration' do
17
+ expect(enumeration.enum).to eq(%i[singular plural])
18
18
  end
19
19
  end # context
20
20
 
21
21
  context 'Provided services:' do
22
- it 'should know whether a value is in domain' do
23
- expect(subject.include?(:dual)).to be_falsey
24
- expect(subject.include?(:singular)).to be_truthy
25
- expect(subject.include?(:plural)).to be_truthy
22
+ it 'knows whether a value is in domain' do
23
+ expect(enumeration).not_to include(:dual)
24
+ expect(enumeration).to include(:singular)
25
+ expect(enumeration).to include(:plural)
26
26
  end
27
27
 
28
- it 'should provide a factory method for enumerated value' do
29
- expect(subject.build_value(:plural)).to be_kind_of(SymbolValue)
30
- value = subject.build_value(:plural)
28
+ it 'provides a factory method for enumerated value' do
29
+ expect(enumeration.build_value(:plural)).to be_a(SymbolValue)
30
+ value = enumeration.build_value(:plural)
31
31
  expect(value.val).to eq(:plural)
32
32
  end
33
33
 
34
- it 'should return all valid values in domain when requested' do
35
- expect(subject.to_a).to eq(%i[singular plural])
34
+ it 'returns all valid values in domain when requested' do
35
+ expect(enumeration.to_a).to eq(%i[singular plural])
36
36
  end
37
37
 
38
- it 'should complain when asked to build a non-member value' do
38
+ it 'complains when asked to build a non-member value' do
39
39
  err = StandardError
40
40
  err_msg = "dual isn't part of enumeration [singular, plural]."
41
- expect { subject.build_value(:dual) }.to raise_error(err, err_msg)
41
+ expect { enumeration.build_value(:dual) }.to raise_error(err, err_msg)
42
42
  end
43
43
  end # context
44
44
  end # describe
@@ -9,36 +9,37 @@ module Zenlish
9
9
  describe FeatureDef do
10
10
  let(:a_name) { 'NUMBER' }
11
11
  let(:a_domain) { EnumerationDomain.new(:singular, :plural) }
12
- subject { FeatureDef.new(a_name, a_domain) }
12
+
13
+ subject(:ft_def) { described_class.new(a_name, a_domain) }
13
14
 
14
15
  context 'Initialization:' do
15
- it 'should be initialized with at least two arguments' do
16
- expect { FeatureDef.new(a_name, a_domain) }.not_to raise_error
16
+ it 'is initialized with at least two arguments' do
17
+ expect { described_class.new(a_name, a_domain) }.not_to raise_error
17
18
  end
18
19
 
19
- it 'could be initialized with a default value argument' do
20
+ it 'can be initialized with a default value argument' do
20
21
  deflt = double('dummy')
21
- expect { FeatureDef.new(a_name, a_domain, deflt) }.not_to raise_error
22
+ expect { described_class.new(a_name, a_domain, deflt) }.not_to raise_error
22
23
  end
23
24
 
24
- it 'should know its name' do
25
- expect(subject.name).to eq(a_name)
25
+ it 'knows its name' do
26
+ expect(ft_def.name).to eq(a_name)
26
27
  end
27
28
 
28
- it 'should know the domain of its values' do
29
- expect(subject.domain).to eq(a_domain)
29
+ it 'knows the domain of its values' do
30
+ expect(ft_def.domain).to eq(a_domain)
30
31
  end
31
32
 
32
- it 'should know the domain of its default value' do
33
- expect(subject.default).to be_nil
33
+ it 'knows the domain of its default value' do
34
+ expect(ft_def.default).to be_nil
34
35
  deflt = double('dummy')
35
- instance = FeatureDef.new(a_name, a_domain, deflt)
36
+ instance = described_class.new(a_name, a_domain, deflt)
36
37
  expect(instance.default).to eq(deflt)
37
38
  end
38
39
 
39
- it 'should guess its default if enumeration has a single member' do
40
+ it 'guesses its default if enumeration has a single member' do
40
41
  basic_domain = EnumerationDomain.new(:plural)
41
- instance = FeatureDef.new(a_name, basic_domain)
42
+ instance = described_class.new(a_name, basic_domain)
42
43
  expect(instance.default.val).to eq(:plural)
43
44
  end
44
45
  end # context