Sha256: 19c78cf85fa501b2b7a8c64d1ac3339c18eb3de65bd198ff2558345726eb7c57

Contents?: true

Size: 694 Bytes

Versions: 14

Compression:

Stored size: 694 Bytes

Contents

require File.join(File.dirname(__FILE__), 'helper')

class TestCurbCurlDownload < Test::Unit::TestCase
  include TestServerMethods 

  def setup
    server_setup(9130)
  end
  
  def test_download_url_to_file
    dl_url = "http://127.0.0.1:9130/ext/curb_easy.c"
    dl_path = File.join("/tmp/dl_url_test.file")

    curb = Curl::Easy.download(dl_url, dl_path)
    assert File.exist?(dl_path)
  end

  def test_download_bad_url_gives_404
    dl_url = "http://127.0.0.1:9130/this_file_does_not_exist.html"
    dl_path = File.join("/tmp/dl_url_test.file")

    curb = Curl::Easy.download(dl_url, dl_path)
    assert_equal Curl::Easy, curb.class
    assert_equal 404, curb.response_code
  end

end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
taf2-curb-0.2.7.4 tests/tc_curl_download.rb
taf2-curb-0.2.8.0 tests/tc_curl_download.rb
taf2-curb-0.3.0.0 tests/tc_curl_download.rb
taf2-curb-0.3.5.0 tests/tc_curl_download.rb
taf2-curb-0.3.6.0 tests/tc_curl_download.rb
taf2-curb-0.4.0.0 tests/tc_curl_download.rb
taf2-curb-0.4.1.0 tests/tc_curl_download.rb
taf2-curb-0.4.2.0 tests/tc_curl_download.rb
curb-0.3.7 tests/tc_curl_download.rb
curb-0.3.5 tests/tc_curl_download.rb
curb-0.3.4 tests/tc_curl_download.rb
curb-0.3.3 tests/tc_curl_download.rb
curb-0.3.2 tests/tc_curl_download.rb
curb-0.3.1 tests/tc_curl_download.rb