Sha256: b4a79d11cb45f82aa27153ea8c7d69f9fd1dfe811130fc2182757e4bf29b4d8b

Contents?: true

Size: 1.77 KB

Versions: 10

Compression:

Stored size: 1.77 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
            actual_results.should 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
            actual_results.should eq results_with_options
        end
    end

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

            run
            actual_results.should 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] )
            results.should eq results_with_empty_options
        end
    end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
arachni-1.2.1 spec/components/plugins/content_types_spec.rb
arachni-1.2 spec/components/plugins/content_types_spec.rb
arachni-1.1 spec/components/plugins/content_types_spec.rb
arachni-1.0.6 spec/components/plugins/content_types_spec.rb
arachni-1.0.5 spec/components/plugins/content_types_spec.rb
arachni-1.0.4 spec/components/plugins/content_types_spec.rb
arachni-1.0.3 spec/components/plugins/content_types_spec.rb
arachni-1.0.2 spec/components/plugins/content_types_spec.rb
arachni-1.0.1 spec/components/plugins/content_types_spec.rb
arachni-1.0 spec/components/plugins/content_types_spec.rb