spec/integration/rambling/trie_spec.rb in rambling-trie-1.0.3 vs spec/integration/rambling/trie_spec.rb in rambling-trie-2.0.0

- old
+ new

@@ -1,36 +1,40 @@ +# frozen_string_literal: true + require 'spec_helper' require 'zip' describe Rambling::Trie do let(:assets_path) { File.join ::SPEC_ROOT, 'assets' } context 'when providing words directly' do it_behaves_like 'a compressible trie' do - let(:words) { %w(a couple of words for our full trie integration test) } let(:trie) { Rambling::Trie.create } + let(:words) { %w(a couple of words for our full trie integration test) } before do trie.concat words end end end context 'when provided with words with unicode characters' do it_behaves_like 'a compressible trie' do - let(:words) { %w(poquísimas palabras para nuestra prueba de integración completa 🙃) } let(:trie) { Rambling::Trie.create } + let(:words) do + %w(poquísimas palabras para nuestra prueba de integración completa 🙃) + end before do trie.concat words end end end context 'when provided with a filepath' do - let(:words) { File.readlines(filepath).map &:chomp! } let(:trie) { Rambling::Trie.create filepath } + let(:words) { File.readlines(filepath).map(&:chomp) } context 'with english words' do it_behaves_like 'a compressible trie' do let(:filepath) { File.join assets_path, 'test_words.en_US.txt' } end @@ -43,10 +47,10 @@ end end describe 'dump and load' do let(:words_filepath) { File.join assets_path, 'test_words.en_US.txt' } - let(:words) { File.readlines(words_filepath).map &:chomp } + let(:words) { File.readlines(words_filepath).map(&:chomp) } context 'when serialized with Ruby marshal format (default)' do it_behaves_like 'a serializable trie' do let(:trie_to_serialize) { Rambling::Trie.create words_filepath } let(:format) { :marshal }