Sha256: ae54705f3fa27867a61b25f34530f6202c26f071673f9aad385521d67174357e

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

require_relative "spec_helper"
require 'tempfile'

describe Melisa::Trie do
  let(:terms) { ['one', 'two', 'onetwo'] }
  let(:trie) { Melisa::Trie.new(terms) }

  it "initializes" do
    trie
  end

  it "tests for inclusion" do
    expect(trie).to include 'one'
    expect(trie).to_not include 'three'
  end

  it "lists keys" do
    expect(trie.keys).to match_array ['one', 'two', 'onetwo']
  end

  it "saves" do
    tmp = Tempfile.new('melisa')
    trie.save(tmp.path)

    trie2 = Melisa::Trie.new
    trie2.load(tmp.path)

    expect(trie2.keys).to match_array ['one', 'two', 'onetwo']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
melisa-0.2.0 spec/trie_spec.rb