Class URI::MySQLTest
In: lib/uri/mysql.rb
Parent: Test::Unit::TestCase

Methods

Public Instance methods

[Source]

# File lib/uri/mysql.rb, line 64
      def setup
        assert_nothing_raised do
          @foo = URI.parse('mysql://foo/qux/bar')
          @foo_at_bar = URI.parse('mysql://foo:baz@bar/baz/ben')
          @foo_at_bar_42 = URI.parse('mysql://foo@bar:42/bing')
          @cmplx = URI.parse('mysql://foo@bar/qux/bob?a=b,c,d=e,f,ghi,jkl=mno')
        end
        @all = [ @foo, @foo_at_bar, @foo_at_bar_42, @cmplx ]
      end

[Source]

# File lib/uri/mysql.rb, line 74
      def test_0_parse_basic
        @all.each do |uri|
          assert_kind_of(MySQL, uri)
        end
      end

[Source]

# File lib/uri/mysql.rb, line 87
      def test_mk_connection_opts
        assert_equal(['-h', 'foo'], @foo.mk_connection_opts)
        assert_equal(%w[-h bar -p baz -u foo], @foo_at_bar.mk_connection_opts)
        assert_equal(%w[-h bar -P]+[42, '-u', 'foo'],
                     @foo_at_bar_42.mk_connection_opts)
        assert_equal(["-h", "bar", "-u", "foo"], @cmplx.mk_connection_opts)
      end

[Source]

# File lib/uri/mysql.rb, line 96
      def test_mk_dump_opts
        base = %w[-C -r out]
        assert_equal(%w[ -C bar ], @foo.mk_dump_opts())
        assert_equal(base + ['bar'], @foo.mk_dump_opts('out'))
        assert_equal(base + ['ben'], @foo_at_bar.mk_dump_opts('out'))
        assert_equal(base + ['bing'], @foo_at_bar_42.mk_dump_opts('out'))
        assert_equal(base + ['bob'], @cmplx.mk_dump_opts('out'))
      end

[Source]

# File lib/uri/mysql.rb, line 105
      def test_save
        # FIXME
      end

[Source]

# File lib/uri/mysql.rb, line 80
      def test_with_query
        ref = %w[-h bar -u foo -C -r out bob -a b -c -d e -f --ghi --jkl mno]
        assert_equal(ref, @cmplx.mk_connection_opts +
                          @cmplx.mk_dump_opts('out') +
                          @cmplx.mk_custom_opts)
      end

[Validate]