Sha256: d44c1d5083a9e64acd7f8c1c27a4ed5c47e516c44fa68b36d805ef3665a61216

Contents?: true

Size: 1.49 KB

Versions: 31

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

require_relative '../../spec_helper' # Use the RSpec framework'
require_relative '../../../lib/zenlish/lex/lexical_entry' # Load the class under test

module Zenlish
  module Lex
    describe LexicalEntry do
      let(:sample_lemma) { 'other' }
      let(:sample_lexeme1) { double('other-as-adjective') }
      let(:sample_lexeme2) { double('other-as-pronoun') }
      subject { LexicalEntry.new(sample_lemma) }

      context 'Initialization:' do
        it 'can be initialized with a lemma only' do
          expect { LexicalEntry.new(sample_lemma) }.not_to raise_error
        end

        it 'can be initialized with a lemma and a word class' do
          expect { LexicalEntry.new(sample_lemma, sample_lexeme1) }.not_to raise_error
        end

        it 'should know its lemma' do
          expect(subject.lemma).to eq(sample_lemma)
        end

        it 'should know its lexeme (if any)' do
          expect(subject.lexemes).to be_empty
          instance = LexicalEntry.new(sample_lemma, sample_lexeme1)
          expect(instance.lexemes).to eq([sample_lexeme1])
        end
      end # context

      context 'Provided services:' do

        it 'should accept links with lexeme(s)' do
          subject.add_lexeme(sample_lexeme1)
          expect(subject.lexemes).to eq([sample_lexeme1])

          subject.add_lexeme(sample_lexeme2)
          expect(subject.lexemes).to eq([sample_lexeme1, sample_lexeme2])
        end
      end # context
    end # describe
  end # module
end # module

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
zenlish-0.2.05 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.2.04 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.2.03 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.2.02 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.2.01 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.2.00 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.25 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.24 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.23 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.22 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.21 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.20 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.19 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.18 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.17 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.16 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.15 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.14 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.13 spec/zenlish/lex/lexical_entry_spec.rb
zenlish-0.1.12 spec/zenlish/lex/lexical_entry_spec.rb