Sha256: 8154a5431f03fe094e26a6a66d9af88c8fe93c6e88153d4284510fc89f7f6cdc

Contents?: true

Size: 1.7 KB

Versions: 4

Compression:

Stored size: 1.7 KB

Contents

require_relative '../../spec_helper'

describe Arachni::Report::Base do
    before( :all ) do
        opts = Arachni::Options.instance
        opts.dir['reports'] = spec_path + 'fixtures/reports/base_spec'

        @framework = Arachni::Framework.new( Arachni::Options.instance )
        @reports   = @framework.reports
    end

    describe '#auditstore' do
        it 'should return the provided auditstore' do
            auditstore = @framework.auditstore
            @reports.run_one( :with_outfile, auditstore ).auditstore.
                should == auditstore
        end
    end

    describe '#outfile' do
        it 'should return the outfile in options' do
            outfile = 'blahfile'
            @reports.run_one( :with_outfile, @framework.auditstore,
                              'outfile' => outfile
            ).outfile.should == outfile
        end
    end

    describe '#format_plugin_results' do
        it 'should run the formatters of appropriate plugin' do
            store = @framework.auditstore
            store.plugins["foobar"] = { :results => 'Blah!' }

            @reports.run_one( 'with_formatters', store )
            IO.read( 'with_formatters' ).should == { 'foobar' => 'Blah!' }.to_s
            File.delete( 'with_formatters' )
        end
    end

    describe '.has_outfile?' do
        context 'when the report has an outfile option' do
            it 'should return true' do
                @reports[:with_outfile].has_outfile?.should be_true
            end
        end
        context 'when the report does not have an outfile option' do
            it 'should return false' do
                @reports[:without_outfile].has_outfile?.should be_false
            end
        end
    end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
arachni-0.4.1.3 spec/arachni/report/base_spec.rb
arachni-0.4.1.2 spec/arachni/report/base_spec.rb
arachni-0.4.1.1 spec/arachni/report/base_spec.rb
arachni-0.4.1 spec/arachni/report/base_spec.rb