Sha256: ad11a740db0c215976a0f74b7dd71e8a5626a17f58c9959f90e84920c2fa6075

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Arachni::Component::Utilities do

    before( :all ) do
        @utils = Arachni::Component::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

10 entries across 10 versions & 1 rubygems

Version Path
arachni-1.2.1 spec/arachni/component/utilities_spec.rb
arachni-1.2 spec/arachni/component/utilities_spec.rb
arachni-1.1 spec/arachni/component/utilities_spec.rb
arachni-1.0.6 spec/arachni/component/utilities_spec.rb
arachni-1.0.5 spec/arachni/component/utilities_spec.rb
arachni-1.0.4 spec/arachni/component/utilities_spec.rb
arachni-1.0.3 spec/arachni/component/utilities_spec.rb
arachni-1.0.2 spec/arachni/component/utilities_spec.rb
arachni-1.0.1 spec/arachni/component/utilities_spec.rb
arachni-1.0 spec/arachni/component/utilities_spec.rb