Sha256: 4baf43d80849eee64cc19d849cf8ab4ceeef4495362713198eed58fe2b872e5a

Contents?: true

Size: 1.16 KB

Versions: 17

Compression:

Stored size: 1.16 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Actions::FetchUrls do
  context '#initialize' do
    it 'requires a set of options' do
      proxy = double('HttpProxy')
      reporter = double('reporter')
      allow(reporter).to receive(:header)

      options = {
        proxy: proxy,
        urls: ['http://localhost:4567/rspec/url_fetcher'],
        timeout: 2,
        count: 1,
        concurrent: false,
        output: StringIO.new,
        reporter: reporter,
      }

      expect {
        Actions::FetchUrls.new(options)
      }.not_to raise_error
    end
  end

  context '#run' do
    it 'fetchs urls' do
      proxy = double('HttpProxy')
      allow(proxy).to receive(:to_string).and_return('http://localhost:3128')

      reporter = double('reporter')
      allow(reporter).to receive(:data)
      allow(reporter).to receive(:header)

      options = {
        proxy: proxy,
        urls: ['http://example.org'],
        timeout: 2,
        count: 2,
        output: StringIO.new,
        concurrent: false,
        reporter: reporter,
      }

      fetcher = Actions::FetchUrls.new(options)
      silence :stderr do
        fetcher.run
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

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