Sha256: 0e973d07fd654359668a4152528fa8cfde60129fc5cb6e7aab5edcf378da0a4f
Contents?: true
Size: 878 Bytes
Versions: 1
Compression:
Stored size: 878 Bytes
Contents
require 'spec_helper' module Rambling describe Trie do describe '.create' do let(:root) { double Trie::Root } before { Trie::Root.stub(:new).and_yield(root).and_return(root) } it 'returns a new instance of the trie root node' do expect(Trie.create).to eq root end context 'with a block' do it 'yields the instantiated root' do yielded_trie = nil Trie.create { |trie| yielded_trie = trie } expect(yielded_trie).to eq root end end context 'with a filename' do let(:filename) { File.join(::SPEC_ROOT, 'assets', 'test_words.txt') } let(:words) { File.readlines(filename).map &:chomp } it 'loads every word' do words.each { |word| root.should_receive(:<<).with(word) } Trie.create filename end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rambling-trie-0.5.0 | spec/lib/rambling/trie_spec.rb |