spec/integration/rambling/trie_spec.rb in rambling-trie-0.9.2 vs spec/integration/rambling/trie_spec.rb in rambling-trie-0.9.3

- old
+ new

@@ -51,23 +51,31 @@ end describe 'with words provided directly' do it_behaves_like 'a compressable trie' do let(:words) { %w[a couple of words for our full trie integration test] } - let(:trie) { Rambling::Trie.create } - - before do - words.each do |word| - trie << word - trie.add word - end - end + let(:trie) { Rambling::Trie.create { |t| words.each { |w| t << w } } } end end describe 'with words from a file' do it_behaves_like 'a compressable trie' do - let(:filepath) { File.join ::SPEC_ROOT, 'assets', 'test_words.txt' } + let(:filepath) { File.join ::SPEC_ROOT, 'assets', 'test_words.en_US.txt' } + let(:words) { File.readlines(filepath).map &:chomp! } + let(:trie) { Rambling::Trie.create filepath } + end + end + + describe 'with words with unicode characters' do + it_behaves_like 'a compressable trie' do + let(:words) { %w[poquísimas palabras para nuestra prueba de integración completa] } + let(:trie) { Rambling::Trie.create { |t| words.each { |w| t << w } } } + end + end + + describe 'with words with unicode characters from a file' do + it_behaves_like 'a compressable trie' do + let(:filepath) { File.join ::SPEC_ROOT, 'assets', 'test_words.en_US.txt' } let(:words) { File.readlines(filepath).map &:chomp! } let(:trie) { Rambling::Trie.create filepath } end end end