Sha256: a70f4565af3d13675130ff31c43336a8d921e337d97d63ed03bef780074af4b2

Contents?: true

Size: 1.44 KB

Versions: 10

Compression:

Stored size: 1.44 KB

Contents

require File.join(File.dirname(__FILE__), 'helper')
class DescribeTest < Test::Unit::TestCase
  context "Given a table and some data" do
    setup do
      @client = Oci8Simple::Client.new("test")
      @client.run "DROP TABLE OCI8_SIMPLE_TEST CASCADE CONSTRAINTS" rescue nil
      @client.run <<-SQL
        CREATE TABLE "OCI8_SIMPLE_TEST"
          (
            "NAME"           VARCHAR2(400 CHAR) DEFAULT 'FOO' NOT NULL ENABLE,
            "ID"             NUMBER(38,0) DEFAULT 7 NOT NULL ENABLE,
            "LONG_THING"     VARCHAR(2000 CHAR) DEFAULT '#{"a " * 50}' NOT NULL ENABLE,
            "TEXTS"          CLOB
          )
      SQL
      @describe = Oci8Simple::Describe.new("test")
    end
    context "describing a table" do
      setup do
      end
      should "format results for the command line" do
        expected=<<-STR
Required  Name        Type      Size    Char?  Char_size  Precision  Scale  Default   
--------------------------------------------------------------------------------------
       *  id          number    22.0                      38.0       0.0    7         
       *  long_thing  varchar2  4000.0  *      2000.0                       a a a a a ...
       *  name        varchar2  1600.0  *      400.0                        FOO       
          texts       clob                                                            
STR

        assert_equal(expected.chop, @describe.run("oci8_simple_test"))
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
oci8_simple-0.9.2 test/describe_test.rb
oci8_simple-0.9.1 test/describe_test.rb
oci8_simple-0.9.0 test/describe_test.rb
oci8_simple-0.8.5 test/describe_test.rb
oci8_simple-0.8.4 test/describe_test.rb
oci8_simple-0.8.3 test/describe_test.rb
oci8_simple-0.8.2 test/describe_test.rb
oci8_simple-0.8.1 test/describe_test.rb
oci8_simple-0.8.0 test/describe_test.rb
oci8_simple-0.7.0 test/describe_test.rb