Sha256: 4da64ed9eb95a7b9fe42f5305ffe1c51e1d16187e0befdfddadc14395e9d5fbc

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'db/h2'
require 'schema_dump'

class H2SchemaDumpTest < Test::Unit::TestCase
  include SchemaDumpTestMethods

  DbTypeMigration.big_decimal_precision = 56 # whatever - arbitrary
  
#  # #override
#  def test_schema_dump_keeps_id_column_when_id_is_false_and_id_column_added
#    output = standard_dump
#    match = output.match(%r{create_table "string_ids"(.*)do.*\n(.*)\n})
#    assert_not_nil(match, "string_ids table not found")
#    assert_match %r(:id => false), match[1], "no table id not preserved"
#    # t.string \"id\", :limit => 2147483647, :null => false
#    assert_match %r{t.string[[:space:]]+"id",.+?:null => false$}, match[2], "non-primary key id column not preserved"
#  end

  def test_schema_dump_decimal_when_scale_specified
    output = standard_dump(StringIO.new, [/^[^d]/]) # keep db_types
    # t.column :sample_small_decimal, :decimal, :precision => 3, :scale => 2, :default => 3.14
    if ar_version('4.0')
      assert_match %r{t.decimal\s+"sample_small_decimal",\s+precision: 3,\s+scale: 2}, output
    else
      assert_match %r{t.decimal\s+"sample_small_decimal",\s+:precision => 3,\s+:scale => 2}, output
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-jdbc-adapter-1.3.0.beta2 test/db/h2/schema_dump_test.rb