Sha256: 73d7cd9fcdfb74a4c282aa353803052c01d59e5c6cca11b09c6c28f2eae5ebbd
Contents?: true
Size: 1.07 KB
Versions: 6
Compression:
Stored size: 1.07 KB
Contents
require 'mechanize/test_case' class TestMechanizeFile < Mechanize::TestCase def setup super @parser = Mechanize::File end def test_save uri = URI 'http://example/name.html' page = Mechanize::File.new uri, nil, '0123456789' Dir.mktmpdir do |dir| Dir.chdir dir do page.save 'test.html' assert_equal '0123456789', File.read('test.html') end end end def test_save_default uri = URI 'http://example/test.html' page = Mechanize::File.new uri, nil, '' Dir.mktmpdir do |dir| Dir.chdir dir do page.save assert File.exist? 'test.html' page.save assert File.exist? 'test.html.1' page.save assert File.exist? 'test.html.2' end end end def test_save_default_dots uri = URI 'http://localhost/../test.html' page = Mechanize::File.new uri, nil, '' Dir.mktmpdir do |dir| Dir.chdir dir do page.save assert File.exist? 'test.html' page.save assert File.exist? 'test.html.1' end end end end
Version data entries
6 entries across 6 versions & 3 rubygems