test/test_subclass.rb in mechanize-0.9.3 vs test/test_subclass.rb in mechanize-1.0.0
- old
+ new
@@ -1,14 +1,30 @@
-require File.expand_path(File.join(File.dirname(__FILE__), "helper"))
+require "helper"
class TestSubclass < Test::Unit::TestCase
def setup
- @agent = WWW::Mechanize.new
+ @agent = Mechanize.new
end
def test_send_cookie
page = @agent.get( :url => "http://localhost/send_cookies",
:headers => {'Cookie' => 'name=Aaron'} )
assert_equal(1, page.links.length)
assert_not_nil(page.links.find { |l| l.text == "name:Aaron" })
+ end
+
+ class Parent < Mechanize
+ @html_parser = :parser
+ @log = :log
+ end
+
+ class Child < Parent
+ end
+
+ def test_subclass_inherits_html_parser
+ assert_equal :parser, Child.html_parser
+ end
+
+ def test_subclass_inherits_log
+ assert_equal :log, Child.log
end
end