Sha256: b3d0f41779fb759a6d95936a993e2c687d1a13709651a5179dfad5a562d2ca4a
Contents?: true
Size: 1.36 KB
Versions: 6
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true require_relative '../../../lib/zenlish/inflect/formal_argument' require_relative '../../../lib/zenlish/inflect/input_asis' # Load the class under test require_relative '../../../lib/zenlish/inflect/substitution' module Zenlish module Inflect describe Substitution do let(:suffix) { LiteralAsIs.new('ies') } let(:sample_argument) { FormalArgument.new(1) } let(:base) { InputAsIs.new(sample_argument) } let(:pattern) { /y$/ } subject { Substitution.new(base, pattern, suffix) } context 'Initialization:' do it 'should be initialized with two arguments' do expect { Substitution.new(base, pattern, suffix) }.not_to raise_error end it 'should know its arguments' do expect(subject.children.first).to eq(base) expect(subject.children[1]).to eq(pattern) expect(subject.children.last).to eq(suffix) end end # context context 'Provided services:' do let(:sample_heading) { double('fake-headings') } let(:sample_values) { [nil, 'cherry', nil] } it 'should do the concatenation of children results' do lexeme = double('fake-lexeme') expect(subject.generate(sample_heading, lexeme, sample_values)).to eq('cherries') end end # context end # describe end # module end # module
Version data entries
6 entries across 6 versions & 1 rubygems