Class URI::PgSQLTest
In: lib/uri/pgsql.rb
Parent: Test::Unit::TestCase

Methods

Public Instance methods

[Source]

# File lib/uri/pgsql.rb, line 63
      def setup
        assert_nothing_raised do
          @foo = URI.parse('pgsql://foo/qux/bar')
          @foo_at_bar = URI.parse('pgsql://foo@bar/baz/ben')
          @foo_at_bar_42 = URI.parse('pgsql://foo@bar:42/bing')
          @cmplx = URI.parse('pgsql://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/pgsql.rb, line 73
      def test_0_parse_basic
        @all.each do |uri|
          assert_kind_of(PgSQL, uri)
        end
      end

[Source]

# File lib/uri/pgsql.rb, line 86
      def test_mk_connection_opts
        assert_equal(['-h', 'foo'], @foo.mk_connection_opts)
        assert_equal(["-h", "bar", "-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/pgsql.rb, line 93
      def test_mk_dump_opts
        base = %w[-F c -Z 9 -C -f out]
        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/pgsql.rb, line 101
      def test_save
        # FIXME
      end

[Source]

# File lib/uri/pgsql.rb, line 79
      def test_with_query
        ref = %w[-h bar -U foo -F c -Z 9 -C -f 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]