spec/lib/rambling/trie/stringifyable_spec.rb in rambling-trie-1.0.3 vs spec/lib/rambling/trie/stringifyable_spec.rb in rambling-trie-2.0.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe Rambling::Trie::Stringifyable do
describe '#as_word' do
let(:node) { Rambling::Trie::Nodes::Raw.new }
@@ -34,11 +36,12 @@
it 'returns the expected small word' do
expect(node[:l][:l].as_word).to eq 'all'
end
it 'raises an error for a non terminal node' do
- expect { node[:l].as_word }.to raise_error Rambling::Trie::InvalidOperation
+ expect { node[:l].as_word }
+ .to raise_error Rambling::Trie::InvalidOperation
end
end
context 'for a long word' do
before do
@@ -68,14 +71,15 @@
add_words node, %w(m dd)
end
it 'returns the words for the terminal nodes' do
expect(compressed_node[:m].as_word).to eq 'am'
- expect(compressed_node[:dd].as_word).to eq 'add'
+ expect(compressed_node[:d].as_word).to eq 'add'
end
it 'raise an error for non terminal nodes' do
- expect { compressed_node.as_word }.to raise_error Rambling::Trie::InvalidOperation
+ expect { compressed_node.as_word }
+ .to raise_error Rambling::Trie::InvalidOperation
end
end
end
end