Sha256: c61ce1c5fd8e83e7fbdb9d99a8de82c80e6df84a18619c2f4250b08c762c9889

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

shared_examples_for "path_extractor" do
    include_examples 'component'

    before( :each ) do
        extractors.namespace.constants.each do |const|
            next if const == :Base
            extractors.namespace.send :remove_const, const
        end
        extractors.clear
    end

    def results
    end

    def text
    end

    def self.easy_test( &block )
        it "extracts the expected paths" do
            raise 'No paths provided via #results, use \':nil\' for \'nil\' results.' if !results

            actual_results.sort.should == results.sort
            instance_eval &block if block_given?
        end
    end

    def doc
        Nokogiri::HTML( text )
    end

    def actual_results
        results_for( name )
    end

    def results_for( name )
        paths = extractors[name].new.run( doc ) || []
        paths.delete( 'http://www.w3.org/TR/REC-html40/loose.dtd' )
        paths.compact.flatten
    end

    module Arachni::Parser::Extractors;end
    def extractors
        @path_extractors ||=
            ::Arachni::Component::Manager.new( options.paths.path_extractors, Arachni::Parser::Extractors )
    end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
arachni-1.1 spec/support/shared/path_extractor.rb
arachni-1.0.6 spec/support/shared/path_extractor.rb
arachni-1.0.5 spec/support/shared/path_extractor.rb
arachni-1.0.4 spec/support/shared/path_extractor.rb
arachni-1.0.3 spec/support/shared/path_extractor.rb
arachni-1.0.2 spec/support/shared/path_extractor.rb
arachni-1.0.1 spec/support/shared/path_extractor.rb
arachni-1.0 spec/support/shared/path_extractor.rb