Sha256: 968d126517f207afd090054f53ba37feccc67bfbd5e3e6a9eb57fd3cbc5cab69

Contents?: true

Size: 1.78 KB

Versions: 11

Compression:

Stored size: 1.78 KB

Contents

require 'spec_helper'

describe name_from_filename do
    include_examples 'plugin'

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

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

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

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

    context 'with default options' do
        it "skips 'text' content types" do
            run
            expect(actual_results).to eq default_results
        end
    end

    context 'with custom \'exclude\' option' do
        it 'skips the provided content types' do
            options.plugins[component_name] = { 'exclude' => 'image|excel' }

            run
            expect(actual_results).to eq results_with_options
        end
    end

    context 'with an empty \'exclude\' option' do
        it 'logs everything' do
            options.plugins[component_name] = { 'exclude' => '' }

            run
            expect(actual_results).to eq results_with_empty_options
        end
    end

    describe '.merge' do
        it 'merges an array of results' do
            results = plugin.merge( [default_results, results_with_options] )
            expect(results).to eq results_with_empty_options
        end
    end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
arachni-1.6.1.3 spec/components/plugins/content_types_spec.rb
arachni-1.6.1.2 spec/components/plugins/content_types_spec.rb
arachni-1.6.1.1 spec/components/plugins/content_types_spec.rb
arachni-1.6.1 spec/components/plugins/content_types_spec.rb
arachni-1.6.0 spec/components/plugins/content_types_spec.rb
arachni-1.5.1 spec/components/plugins/content_types_spec.rb
arachni-1.5 spec/components/plugins/content_types_spec.rb
arachni-1.4 spec/components/plugins/content_types_spec.rb
arachni-1.3.2 spec/components/plugins/content_types_spec.rb
arachni-1.3.1 spec/components/plugins/content_types_spec.rb
arachni-1.3 spec/components/plugins/content_types_spec.rb