Sha256: 7cabb913e2e6b085dc41d9134b183f2eec28a7b9a52e57e187f630244a4d6dc0

Contents?: true

Size: 436 Bytes

Versions: 6

Compression:

Stored size: 436 Bytes

Contents

require 'tempfile'
require 'fileutils'

module Helpers
  def wordlist_tempfile(existing_file=nil)
    path = Tempfile.new('wordlist').path

    ::FileUtils.cp(existing_file,path) if existing_file
    return path
  end

  def should_contain_words(path,expected)
    words = []

    ::File.open(path) do |file|
      file.each_line do |line|
        words << line.chomp
      end
    end

    words.sort.should == expected.sort
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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