Sha256: c62b0da314f615fa403f26a248a2d00a2cfd7375dbb653abeac9dd656417cebb

Contents?: true

Size: 882 Bytes

Versions: 1

Compression:

Stored size: 882 Bytes

Contents

require "spec_helper"

describe MemoryDictionary::Dictionary do
  #smoke test

  let(:dictionary) { create(:dictionary_with_words) }

  before(:each) { dictionary.save }

  describe "#words" do
    it "has words" do
      expect(dictionary.reload.words.count).to eq(2)
    end
  end

  describe "#translations" do
    it "retrieve translations" do
      expect(dictionary.reload.translations).to eq(["is awesome", "is faster"])
    end
  end

  describe "#words_by_translation" do
    it "search words by translation" do
      words = dictionary.reload.words_by_translation("is faster")
      expect(words.count).to eq(1)
      expect(words.first.name).to eq('rubinius')
    end
  end

  describe "#append_word" do
    it "appends a new word" do
      expect{ dictionary.reload.append_word('jruby', 'is jruby...') }.to change{ dictionary.reload.words.count}.by 1
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
memory_dictionary-1.0.0 spec/memory_dictionary/dictionary_spec.rb