Sha256: f472f9d8da71fcaa0a7f8479ad9a76a5d2f8dddd5e428de4e48b9658808dabbf

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

require 'test_helper'
require 'db/h2'

class H2IdentityColumnTest < Test::Unit::TestCase

  class Persona < ActiveRecord::Base
  end

  class CreatePersonasTable < ActiveRecord::Migration
    def self.up
      create_table :personas do |t|
        t.string :firstname
        t.string :lastname
      end
    end

    def self.down
      drop_table :personas
    end
  end

  def setup
    CreatePersonasTable.up
    Persona.create(:firstname => "John",     :lastname => "Smith")
  end

  def teardown
    CreatePersonasTable.down
  end

  def test_auto_increment
    assert_equal 1, Persona.all[0].id, "H2 auto increment initially should start at ID 1, not 0"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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