Sha256: 8d643b8c38afa6d05fe68a0510f7820d56b93fddc919b0bed3d5e51a4d5ce9b1
Contents?: true
Size: 967 Bytes
Versions: 3
Compression:
Stored size: 967 Bytes
Contents
require 'mechanize/test_case' class TestMechanizeDownload < Mechanize::TestCase def setup super @parser = Mechanize::Download end def test_save_string_io uri = URI.parse 'http://example/foo.html' body_io = StringIO.new '0123456789' download = @parser.new uri, nil, body_io in_tmpdir do download.save assert File.exist? 'foo.html' end end def test_save_tempfile uri = URI.parse 'http://example/foo.html' Tempfile.open __name__ do |body_io| body_io.unlink body_io.write '0123456789' body_io.flush body_io.rewind download = @parser.new uri, nil, body_io in_tmpdir do download.save assert File.exist? 'foo.html' end end end def test_filename uri = URI.parse 'http://example/foo.html' body_io = StringIO.new '0123456789' download = @parser.new uri, nil, body_io assert_equal "foo.html", download.filename end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mechanize-2.2.1 | test/test_mechanize_download.rb |
mechanize-2.2 | test/test_mechanize_download.rb |
mechanize-2.1.1 | test/test_mechanize_download.rb |