Sha256: 3aee2741c4c0f4448cacb43e46362b43249ffe59ce9957ff713ab1da04a62904

Contents?: true

Size: 1.07 KB

Versions: 12

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

shared_examples CMSScanner::Target::Server::IIS do
  describe '#server' do
    its(:server) { should eq :IIS }
  end

  describe '#directory_listing?, #directory_listing_entries' do
    before     { stub_request(:get, target.url(path)).to_return(body: body, status: status) }
    let(:path) { 'dir' }

    context 'when not a 200' do
      let(:status) { 404 }
      let(:body)   { '' }

      it 'returns false and an empty array' do
        expect(target.directory_listing?(path)).to be false
        expect(target.directory_listing_entries(path)).to eql []
      end
    end

    context 'when 200' do
      let(:status) { 200 }

      %w(with_parent.html no_parent.html).each do |file|
        context "when #{file} body" do
          let(:body)   { File.read(File.join(fixtures, 'directory_listing', file)) }

          it 'returns true and the expected array' do
            expect(target.directory_listing?(path)).to be true
            expect(target.directory_listing_entries(path)).to eq %w(sub-dir web.config)
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cms_scanner-0.0.18 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.17 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.16 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.15 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.14 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.13 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.12 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.11 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.10 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.9 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.8 spec/shared_examples/target/server/iis.rb
cms_scanner-0.0.7 spec/shared_examples/target/server/iis.rb