Skip to content

Commit

Permalink
Remove unnecessary tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzedge committed Feb 19, 2018
1 parent 1130783 commit 9c0976f
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions spec/lib/rambling/trie/nodes/compressed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,4 @@ def assign_letter letter
end.to raise_error Rambling::Trie::InvalidOperation
end
end

describe '#match_prefix' do
before do
raw_node.letter = :i
add_words raw_node, %w(gnite mport mportant mportantly)
end

context 'when the node is terminal' do
before do
raw_node.terminal!
end

it 'adds itself to the words' do
expect(node.match_prefix %w(g n i t e)).to include 'i'
end
end

context 'when the node is not terminal' do
it 'does not add itself to the words' do
expect(node.match_prefix %w(g n i t e)).not_to include 'i'
end
end

context 'when the first few chars match a terminal node' do
it 'adds those terminal nodes to the words' do
words = node.match_prefix(%w(m p o r t a n t l y)).to_a
expect(words).to include 'import', 'important', 'importantly'
end
end

context 'when the first few chars do not match a terminal node' do
it 'does not add any other words found' do
words = node.match_prefix(%w(m p m p o r t a n t l y)).to_a
expect(words).not_to include 'import', 'important', 'importantly'
end
end
end
end

0 comments on commit 9c0976f

Please sign in to comment.