Sha256: 066566dc535677c5e429449ff9eea6d858b9ef534cf636b58eac3cc7b8c45f99

Contents?: true

Size: 607 Bytes

Versions: 1

Compression:

Stored size: 607 Bytes

Contents

require 'spec_helper'

describe WordsMatrix::Dictionary do
  let(:dict_path) {'spec/fixtures/test_dict.txt'}
  let(:subject) {WordsMatrix::Dictionary.new(6, 9, dict_path)}

  describe "#initialize" do
    its(:words) { should_not be_nil }

    it "should save only words of required length" do
      expect(subject.words.keys).to eq ["P"]
    end

    context "file unreadable" do
      it "should raise an error" do
        expect{ WordsMatrix::Dictionary.new(15, 15, "inexisting path")}.to raise_error(IOError, /error while reading dictionary file: No such file or directory/)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
words_matrix-0.0.1 spec/words_matrix/dictionary_spec.rb