spec/zenlish/inflect/inflection_rule_spec.rb in zenlish-0.2.05 vs spec/zenlish/inflect/inflection_rule_spec.rb in zenlish-0.2.06
- old
+ new
@@ -15,20 +15,22 @@
# Load the class under test
require_relative '../../../lib/zenlish/inflect/inflection_rule'
module Zenlish
module Inflect
+ # rubocop: disable Naming/VariableNumber
+
describe InflectionRule do
# One rule in row representation:
# | plural | ~ /[^aeiouy]y$/ | sub(base_form, /y$/, "ies")|
# Heading part
let(:feature_name) { 'NUMBER' }
let(:heading0) { FeatureHeading.new(feature_name) }
let(:method_name) { 'base_form' }
let(:heading1) { MethodHeading.new(method_name) }
let(:headings) { [heading0, heading1] }
-
+
# Condition part
let(:feature_value) { :plural }
let(:arg_0) { FormalArgument.new(0) }
let(:cond_0) { EqualsLiteral.new(arg_0, feature_value) }
let(:arg_1) { FormalArgument.new(1) }
@@ -44,12 +46,13 @@
subject { InflectionRule.new(conditions, consequent) }
context 'Initialization:' do
it 'should be initialized with condition and consequent parts' do
- expect { InflectionRule.new(conditions, consequent)
- }.not_to raise_error
+ expect do
+ InflectionRule.new(conditions, consequent)
+ end.not_to raise_error
end
it 'should know its condition part' do
expect(subject.conditions).to eq(conditions)
end
@@ -80,11 +83,11 @@
it 'should generate inflected form when rule iworks for actuals' do
actuals = [:plural, 'cherry']
expect(subject.apply(headings, fake_lexeme, actuals)).to eq('cherries')
end
-
+
it 'should succeed when all conditions succeed for given lexeme' do
expect(subject.success?(headings, lexeme, [])).to be_truthy
end
it 'should fail when one condition fails with given lexeme' do
@@ -93,10 +96,11 @@
expect(subject.success?(headings, lex_m2, [])).to be_falsy
end
it 'should generate inflected form when rule works for given lexeme' do
expect(subject.apply(headings, lexeme, [])).to eq('cherries')
- end
+ end
end # context
end # describe
+ # rubocop: enable Naming/VariableNumber
end # module
end # module