require 'eymiha/test' require 'eymiha/url' class TC_url_opener < Test::Unit::TestCase # exception_handler is tested indirectly # relative_base is tested in UrlNormalizer # method_missing is tested indirectly # windows registry access is assumed correct include Eymiha def test_open_apple url_opener = UrlOpener.new probe UrlOpener, :open_apple do assert(url_opener.open_apple("foo") == "open foo") end url_opener.url_viewer = "url_viewer" probe UrlOpener, :open_apple do assert(url_opener.open_apple("foo") == "url_viewer foo") end end def test_open_pc url_opener = UrlOpener.new UrlOpener.windows_browser = "windows_browser" probe UrlOpener, :open_pc do assert(url_opener.open_pc("foo") == "windows_browser foo") end url_opener.url_viewer = "url_viewer" probe UrlOpener, :open_pc do assert(url_opener.open_pc("foo") == "url_viewer foo") end end def test_open_other url_opener = UrlOpener.new(self,nil,nil) probe UrlOpener, :open_other do assert_raise(UrlException) { url_opener.open_foo } end url_opener.url_viewer = "url_viewer" probe UrlOpener, :open_other do assert(url_opener.open_other("foo") == "url_viewer foo") end end end # just for testing... class Eymiha::UrlOpener def system(command) command end def url_normalizer=(url_normalizer) @url_normalizer = url_normalizer end def normalize(url,relative_base) url end def self.windows_browser=(windows_browser) @@windows_browser = windows_browser end def handle raise UrlException end end