Sha256: b67ab8c735bc10cf6b4bd8b2d238d473d2a80ef81939b55f6b78feda09938991
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
require 'helper' class TestDownlow < Test::Unit::TestCase context "Downlow" do setup do FileUtils.rm_rf(tmp_dir) if File.readable?(tmp_dir) end context ".get" do should "fetch a gzip then extract it" do url = 'http://example.org/example.tar.gz' FakeWeb.register_uri(:get, url, :body => fixture('test.tar.gz')) path = Downlow.get(url, :destination => File.join(tmp_dir, 'final')) assert path.is_a?(Pathname) assert_match(/final/, path.to_s) assert (path + 'test/test.jpg').readable? end should "assume string as second arg is destination" do url = 'http://example.org/example.tar.gz' FakeWeb.register_uri(:get, url, :body => fixture('test.tar.gz')) path = Downlow.get(url, File.join(tmp_dir, 'final')) assert path.is_a?(Pathname) assert_match(/final/, path.to_s) assert (path + 'test/test.jpg').readable? end should "fetch a single file to a destination" do url = 'http://example.org/example.js' FakeWeb.register_uri(:get, url, :body => fixture('sammy.git/lib/sammy.js')) path = Downlow.get(url, File.join(tmp_dir, 'final')) assert path.is_a?(Pathname) assert_match(/final/, path.to_s) assert path.file? end should "move a single file to a destination" do path = Downlow.get(fixture_path('sammy.git/lib/sammy.js'), File.join(tmp_dir, 'final')) assert path.is_a?(Pathname) assert_match(/final/, path.to_s) assert path.file? end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
downlow-0.1.4 | test/test_downlow.rb |