Sha256: 71cfea273c0060420b2558dddd754818c9c1569cd05be6fa1e07acca07e044d9

Contents?: true

Size: 831 Bytes

Versions: 6

Compression:

Stored size: 831 Bytes

Contents

class DownloaderTest < Test::Unit::TestCase
  include Helper::Sandbox

  sub_test_case("#download") do
    def setup
      setup_sandbox
    end

    def teardown
      teardown_sandbox
    end

    test("too many redirection") do
      first_url = "https://example.com/file"
      last_url = "https://example.com/last_redirection"
      expected_message = "too many redirections: #{first_url} .. #{last_url}"
      output_path = @tmp_dir + "file"
      downloader = Datasets::Downloader.new(first_url)

      downloader.define_singleton_method(:start_http) do |url, headers|
        raise Datasets::Downloader::TooManyRedirects, "too many redirections: #{last_url}"
      end

      assert_raise(Datasets::Downloader::TooManyRedirects.new(expected_message)) do
        downloader.download(output_path)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
red-datasets-0.1.7 test/test-downloader.rb
red-datasets-0.1.6 test/test-downloader.rb
red-datasets-0.1.5 test/test-downloader.rb
red-datasets-0.1.4 test/test-downloader.rb
red-datasets-0.1.3 test/test-downloader.rb
red-datasets-0.1.2 test/test-downloader.rb