Sha256: 185cfcb989fa29a6f01acd9d24e02b0a6f58d0c46ad114204d13656f1f391d3e

Contents?: true

Size: 1.41 KB

Versions: 10

Compression:

Stored size: 1.41 KB

Contents

require File.join(File.dirname(__FILE__), 'helper')
class CliTest < 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"
          (
            "ID"             NUMBER(38,0) NOT NULL ENABLE,
            "NAME"           VARCHAR2(400 CHAR) NOT NULL ENABLE,
            "TEXTS"          CLOB
          )
      SQL
      @client.run "INSERT INTO OCI8_SIMPLE_TEST (ID, NAME, TEXTS) VALUES (1, 'Johnny', 'OMG')"
      @client.run "INSERT INTO OCI8_SIMPLE_TEST (ID, NAME, TEXTS) VALUES (2, 'Jenny', 'OMG')"
      @cli = Oci8Simple::Cli.new("test")
    end
    context "with an env" do
      setup do
        @cli = Oci8Simple::Cli.new("test")
      end
      should "format results for the command line" do
        assert_equal("1, Johnny, OMG\n2, Jenny, OMG", @cli.run("select * from oci8_simple_test"))
      end
      should "format results for the command line using column names" do
        assert_equal("name: Johnny\n\nname: Jenny", @cli.run("select name from oci8_simple_test", :hash => true))
      end
    end
    context "without an env" do
      setup do
        @cli = Oci8Simple::Cli.new
      end
      should "default to development" do
        assert_equal("development", @cli.client.env)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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