Sha256: 0900d7a490e6975958b9982846e4e69120a597fd61c7a8af42d18dbc8cd7f25e

Contents?: true

Size: 989 Bytes

Versions: 5

Compression:

Stored size: 989 Bytes

Contents

require 'spec_helper'

shared_examples CMSScanner::Target::Server::Apache do

  describe '#server' do
    its(:server) { should eq :Apache }
  end

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

    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 }
      let(:body)   { File.read(File.join(fixtures, 'directory_listing', '2.2.16.html')) }

      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(backup.php database-empty.php)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cms_scanner-0.0.6 spec/shared_examples/target/server/apache.rb
cms_scanner-0.0.5 spec/shared_examples/target/server/apache.rb
cms_scanner-0.0.4 spec/shared_examples/target/server/apache.rb
cms_scanner-0.0.3 spec/shared_examples/target/server/apache.rb
cms_scanner-0.0.2 spec/shared_examples/target/server/apache.rb