Sha256: 306ab7cf7ceeb776a0ecab3681f6c090e5f0fd11f72d6b8bc05cadbd646286d8

Contents?: true

Size: 1.87 KB

Versions: 9

Compression:

Stored size: 1.87 KB

Contents

require 'spec_helper'

describe name_from_filename do
    include_examples 'plugin'

    before ( :all ) do
        options.url = url
    end

    def results
        framework.plugins.results[name_from_filename][:results]
    end

    def default_results
        yaml_load <<YAML
---
image/png:
- :url: __URL__png
  :method: GET
  :params:
application/vnd.ms-excel:
- :url: __URL__excel
  :method: GET
  :params:
YAML
    end

    def results_with_options
        yaml_load <<YAML
---
text/html;charset=utf-8:
- :url: __URL__
  :method: GET
  :params:
text/css:
- :url: __URL__css
  :method: GET
  :params:
YAML
    end

    def results_with_empty_options
        yaml_load <<YAML
---
text/html;charset=utf-8:
- :url: __URL__
  :method: GET
  :params:
text/css:
- :url: __URL__css
  :method: GET
  :params:
image/png:
- :url: __URL__png
  :method: GET
  :params:
application/vnd.ms-excel:
- :url: __URL__excel
  :method: GET
  :params:
YAML
    end

    context 'with default options' do
        it "skips 'text' content types" do
            run
            results.should eq default_results
        end
    end

    context 'with custom \'exclude\' option' do
        it "skips the provided content types" do
            Arachni::Options.plugins = { name_from_filename => { 'exclude' => 'image|excel' } }
            run
            results.should eq results_with_options
        end
    end

    context 'with an empty \'exclude\' option' do
        it "logs everything" do
            Arachni::Options.plugins = { name_from_filename => { 'exclude' => '' } }
            run
            results.should eq results_with_empty_options
        end
    end

    describe '.merge' do
        it 'merges an array of results' do
            results = framework.plugins[name_from_filename].merge [ default_results, results_with_options ]
            results.should eq results_with_empty_options
        end
    end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
arachni-0.4.7 spec/plugins/content_types_spec.rb
arachni-0.4.6 spec/plugins/content_types_spec.rb
arachni-0.4.5.2 spec/plugins/content_types_spec.rb
arachni-0.4.5.1 spec/plugins/content_types_spec.rb
arachni-0.4.5 spec/plugins/content_types_spec.rb
arachni-0.4.4 spec/plugins/content_types_spec.rb
arachni-0.4.3.2 spec/plugins/content_types_spec.rb
arachni-0.4.3.1 spec/plugins/content_types_spec.rb
arachni-0.4.3 spec/plugins/content_types_spec.rb