Class URI::GenericEx::Test
In: lib/uri/generic_ex.rb
Parent: Test::Unit::TestCase

Methods

Public Instance methods

[Source]

# File lib/uri/generic_ex.rb, line 106
        def setup
          assert_nothing_raised { @foo = URI.parse('http://foo/qux/bar') }
          assert_nothing_raised do
            @cmplx = URI.parse('http://foo@bar/qux/bob?a=b,c,d=e,f,ghi,jkl=mno')
          end
        end

[Source]

# File lib/uri/generic_ex.rb, line 113
        def teardown
          URI::GenericEx.remove_subclasses
          load 'uri/druby.rb' # FIXME
          load 'uri/file.rb'  # FIXME
        end

[Source]

# File lib/uri/generic_ex.rb, line 146
        def test_lazy_loading_full
          PathList[__FILE__.to_path.dirname.parent + '(uri/**/*).rb'].each do |full, path|
            assert_nothing_raised do
              next if path.to_s == 'uri/generic_ex'
              class_name = path.to_s.gsub(/_ex$/, '').camelize
              class_object = class_name.constantize
              assert_equal class_name, class_object.name
              assert_match(/URI::Generic(Ex)?/, class_object.superclass.name,
                            "Superclass of #{class_object}")
            end
          end
        end

[Source]

# File lib/uri/generic_ex.rb, line 131
        def test_lazy_loading_one
          assert_nothing_raised do
            assert_equal 'URI::DRuby', URI::DRuby.name
            assert_equal URI::GenericEx, URI::DRuby.superclass
          end
        end

[Source]

# File lib/uri/generic_ex.rb, line 138
        def test_lazy_loading_one2
          assert_equal 'File', ::File.name
          assert_nothing_raised do
            assert_equal 'URI::File', 'URI::File'.constantize.name
            assert_equal URI::GenericEx, 'URI::File'.constantize.superclass
          end
        end

[Source]

# File lib/uri/generic_ex.rb, line 126
        def test_mk_custom_opts
          assert_equal([], @foo.mk_custom_opts)
          assert_equal(%w[-a b -c -d e -f --ghi --jkl mno], @cmplx.mk_custom_opts)
        end

[Source]

# File lib/uri/generic_ex.rb, line 119
        def test_uri_inflections
          assert_equal 'URI', 'uri'.camelize
          assert_equal 'Security', 'security'.camelize 
          assert_equal 'Sec::URI::Ty', 'sec/uri/ty'.camelize
          assert_equal 'uri/druby', 'URI::DRuby'.underscore
        end

[Validate]