Sha256: 8fe801bd7eda6a13939339987849a166343eb804960f80291aa6a175d84afb3c

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8
require_relative '../../spec_helper'

describe Arachni::Module::Utilities do

    before( :all ) do
        @utils = Arachni::Module::Utilities
    end

    describe '#read_file' do
        it 'should read 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 'should read 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

4 entries across 4 versions & 1 rubygems

Version Path
arachni-0.4.1.3 spec/arachni/module/utilities_spec.rb
arachni-0.4.1.2 spec/arachni/module/utilities_spec.rb
arachni-0.4.1.1 spec/arachni/module/utilities_spec.rb
arachni-0.4.1 spec/arachni/module/utilities_spec.rb