Sha256: 99a1975b66f283428532336df875e0779a3a2f64be6ee11ef2770c2df8be31f5

Contents?: true

Size: 1022 Bytes

Versions: 5

Compression:

Stored size: 1022 Bytes

Contents

require 'spec_helper'

describe CMSScanner::Finders::InterestingFile::Headers do

  subject(:finder) { described_class.new(target) }
  let(:target)     { CMSScanner::Target.new(url) }
  let(:url)        { 'http://example.com/' }
  let(:fixtures)   { File.join(FIXTURES, 'interesting_files', 'headers') }
  let(:fixture)    { File.join(fixtures, 'interesting.txt') }
  let(:headers)    { parse_headers_file(fixture) }

  describe '#passive' do
    before { stub_request(:get, url).to_return(headers: headers) }

    after do
      if @expected
        result = finder.passive

        expect(result).to be_a CMSScanner::Headers
        expect(result).to eql @expected
      end
    end

    context 'when no headers' do
      let(:headers) { {} }

      its(:passive) { should be nil }
    end

    context 'when headers' do
      it 'returns the result' do
        opts      = { confidence: 100, found_by: 'Headers (passive detection)' }
        @expected = CMSScanner::Headers.new(url, opts)
      end
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cms_scanner-0.0.6 spec/app/finders/interesting_files/headers_spec.rb
cms_scanner-0.0.5 spec/app/finders/interesting_files/headers_spec.rb
cms_scanner-0.0.4 spec/app/finders/interesting_files/headers_spec.rb
cms_scanner-0.0.3 spec/app/finders/interesting_files/headers_spec.rb
cms_scanner-0.0.2 spec/app/finders/interesting_files/headers_spec.rb