Sha256: 300554f110d05d4d70b217be4d99ecd876bb70850d641bc239103bdf229e8f12

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require_relative '../../spec_helper' # Use the RSpec framework
require_relative '../../../lib/zenlish/wclasses/common_noun'
require_relative '../../../lib/zenlish/lang/dictionary' # Load the class under test

module Zenlish
  module Lang
    describe Dictionary do
      subject { Dictionary }

      context 'Provided services:' do
        let(:common_nouns) do
          # Some Zenlish common nouns
          %w( animal body container here kind machine moment now part people
              person place side surface thing time word)
        end

        it 'should give the list of common nouns' do
          lexemes = []
          subject.entries.each do |ent|
            lexm = ent.lexemes.select { |lx| lx.wclass.kind_of?(Zenlish::WClasses::CommonNoun) }
            lexemes.concat(lexm) if lexm
          end
          lemmas = lexemes.map { |lx| lx.entry.lemma }

          expect(common_nouns.all? { |c_n| lemmas.include?(c_n) }).to be_truthy
        end

      end # context
    end # describe
  end # module
end # module

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zenlish-0.2.01 spec/zenlish/lang/dictionary_spec.rb
zenlish-0.2.00 spec/zenlish/lang/dictionary_spec.rb