Sha256: 14f5afc74773e93097cef0f75f52a4bbaba0fe5855c037d767e8bf3be5ddb9d6

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

require_relative '../../spec_helper' # Use the RSpec framework
require_relative '../../../lib/zenlish/lex/lexical_entry'
require_relative '../../../lib/zenlish/lex/lexeme'

# Load the class under test
require_relative '../../../lib/zenlish/wclasses/modal_verb_can'

module Zenlish
  module WClasses
    describe ModalVerbCan do
      subject { ModalVerbCan.new }

      context 'Initialization:' do
        it 'should be initialized without argument' do
          expect { ModalVerbCan.new }.not_to raise_error
        end
      end # context

      context 'Provided services:' do
        it 'should know its inherited feature definitions' do
          expect(subject['NUMBER']).to be_kind_of(Feature::FeatureDef)
          expect(subject['PERSON']).to be_kind_of(Feature::FeatureDef)
          expect(subject['PARADIGM'].default.val).to eq('Verb_can_inflection')
        end

        def build_verb(aBaseForm)
          entry = Zenlish::Lex::LexicalEntry.new(aBaseForm)
          lexeme = Zenlish::Lex::Lexeme.new(subject, entry)
        end

        def test_inflection_of(verb_form, pairs)
          verb = build_verb(verb_form)
          pairs.each do |(time, expected_form)|
            expect(verb.inflect([time])).to eq(expected_form)
          end
        end

        it 'should know how to inflect modal verb can' do
          expectations_1 = [
            [:present,     'can'],
            [:past_simple, 'could']
          ]
          test_inflection_of('can', expectations_1)
        end
      end # context
    end # describe
  end # module
end # module

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zenlish-0.2.05 spec/zenlish/wclasses/modal_verb_can_spec.rb
zenlish-0.2.04 spec/zenlish/wclasses/modal_verb_can_spec.rb