Sha256: b1e720281b7e68f7118553f477a791d783818c227b86e8fc2e25443d60e9b720

Contents?: true

Size: 1.29 KB

Versions: 17

Compression:

Stored size: 1.29 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Reporters::FetchUrls do
  context '#initialize' do
    it 'does not require any parameter' do
      expect {
        Reporters::FetchUrls.new
      }.not_to raise_error
    end

    it 'accepts an io object' do
      expect {
        Reporters::FetchUrls.new(StringIO.new)
      }.not_to raise_error
    end

  end

  context '#data' do
    let(:data) {
      {
        headers: {
          "Date" => "Fri, 21 Mar 2014 09:49:09 GMT",
          "Server" => "Apache",
          "Location" => "http://www.sg-zertifikate.de/dwr/call/plainpoll/ReverseAjax.dwr",
          "Content-Length" => "271",
          "Content-Type" => "text/html; charset=iso-8859-1",
          "Connection" => "close",
          "Age" => "1"
        },
        status: 301,
        url: 'http://www.sg-zertifikate.de/dwr/call/plainpoll/ReverseAjax.dwr',
        proxy: 'proxy:3128',
      }
    }

    it 'generates output' do
      reporter = Reporters::FetchUrls.new

      result = capture :stdout do
        reporter.data(data)
      end

      expect(result).to match(/url\s+:/)
    end

    it 'uses io object' do
      output   = StringIO.new
      reporter = Reporters::FetchUrls.new(output)

      reporter.data(data)

      expect(output.string).to match(/url\s+:/)
    end
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
proxy_tester-0.1.10 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.1.8 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.1.6 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.1.5 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.1.4 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.1.3 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.1.2 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.1.1 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.1.0 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.0.9 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.0.8 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.0.7 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.0.6 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.0.5 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.0.4 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.0.3 spec/reporters/fetch_urls_spec.rb
proxy_tester-0.0.2 spec/reporters/fetch_urls_spec.rb