Sha256: b0eeacf0f6fb40e44b9175979414ecbb32fa89840b95cf278e2609b65b5dce64

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'
require 'helpers/text'
require 'helpers/wordlist'

shared_examples_for "a wordlist Builder" do
  include Helpers

  before(:all) do
    @words = ['dog', 'cat', 'catx', 'dat', 'dog', 'cat']
    @sentence = 'dog cat catx, dog dat.'
    @text = 'dog cat: catx. dog cat dat dog.'
    @file = Helpers::SAMPLE_TEXT
  end

  it "should build a unique wordlist from words" do
    Builder.build(@path) do |wordlist|
      wordlist += @words
    end

    should_contain_words(@path,@expected)
  end

  it "should build a unique wordlist from a sentence" do
    Builder.build(@path) do |wordlist|
      wordlist.parse(@sentence)
    end

    should_contain_words(@path,@expected)
  end

  it "should build a unique wordlist from text" do
    Builder.build(@path) do |wordlist|
      wordlist.parse(@text)
    end

    should_contain_words(@path,@expected)
  end

  it "should build a unique wordlist from a file" do
    Builder.build(@path) do |wordlist|
      wordlist.parse_file(@file)
    end

    should_contain_words(@path,@expected)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wordlist-1.1.1 spec/builder_examples.rb
wordlist-1.1.0 spec/builder_examples.rb
wordlist-1.0.3 spec/builder_examples.rb
wordlist-1.0.2 spec/builder_examples.rb
wordlist-1.0.1 spec/builder_examples.rb
wordlist-1.0.0 spec/builder_examples.rb
wordlist-0.1.1 spec/builder_examples.rb