Sha256: 0590435249616ad79633c30c07bdae04af9213c39299420b7eb3f3dd784208af
Contents?: true
Size: 1.03 KB
Versions: 9
Compression:
Stored size: 1.03 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Arachni::Module::Utilities do before( :all ) do @utils = Arachni::Module::Utilities end describe '#read_file' do it 'reads a file from a directory with the same name as the caller and return an array of stripped lines' do filename = 'read_file.txt' filepath = File.expand_path( File.dirname( __FILE__ ) ) + '/utilities_spec/' + filename @utils.read_file( filename ).join( "\n" ).should == IO.read( filepath ).strip end context 'if a block is given' do it 'reads a file from a directory with the same name as the caller one stripped line at a time' do filename = 'read_file.txt' filepath = File.expand_path( File.dirname( __FILE__ ) ) + '/utilities_spec/' + filename lines = [] @utils.read_file( filename ){ |line| lines << line } lines.join( "\n" ).should == IO.read( filepath ).strip end end end end
Version data entries
9 entries across 9 versions & 1 rubygems