Sha256: d668d4bce2d48178cf1b9dcf7595acc666e6118ab3b4c3606eb4184e8cc32495
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
require "helper" class SchemeTest < MiniTest::Unit::TestCase def setup @agent = Mechanize.new @agent.log = Class.new(Object) do def method_missing(*args) end end.new end def test_file_scheme f = File.expand_path(__FILE__) page = @agent.get("file://#{f}") assert_equal(File.read(f), page.body) end def test_file_scheme_parses_html f = File.expand_path( File.join(File.dirname(__FILE__), "htdocs", 'google.html')) page = @agent.get("file://#{f}") assert_equal(File.read(f), page.body) assert_kind_of(Mechanize::Page, page) end def test_file_scheme_supports_directories f = File.expand_path(File.join(File.dirname(__FILE__), "htdocs")) page = @agent.get("file://#{f}") assert_equal(Dir[File.join(f, '*')].length, page.links.length) assert_kind_of(Mechanize::Page, page) end def test_click_file_link f = File.expand_path(File.join(File.dirname(__FILE__), "htdocs")) page = @agent.get("file://#{f}") link = page.links.find { |l| l.text =~ /tc_follow_meta/ } path = URI.parse(link.href).path page = link.click assert_equal(File.read(path), page.body) link = page.meta_refresh.first page = @agent.click(link) assert_equal("http://localhost/index.html", @agent.history.last.uri.to_s) end end
Version data entries
3 entries across 3 versions & 3 rubygems
Version | Path |
---|---|
aai10-mechanize-2.0.1.0 | test/test_scheme.rb |
neocoin-mechanize-2.0.2 | test/test_scheme.rb |
mechanize-2.0.1 | test/test_scheme.rb |