class PostgresqlSerialTest

Public Instance Methods

test_not_serial_column() click to toggle source
# File activerecord/test/cases/adapters/postgresql/serial_test.rb, line 30
def test_not_serial_column
  column = PostgresqlSerial.columns_hash["serials_id"]
  assert_equal :integer, column.type
  assert_equal "integer", column.sql_type
  assert_not column.serial?
end
test_schema_dump_with_not_serial() click to toggle source
# File activerecord/test/cases/adapters/postgresql/serial_test.rb, line 42
def test_schema_dump_with_not_serial
  output = dump_table_schema "postgresql_serials"
  assert_match %r{t\.integer\s+"serials_id",\s+default: -> \{ "nextval\('postgresql_serials_id_seq'::regclass\)" \}$}, output
end
test_schema_dump_with_shorthand() click to toggle source
# File activerecord/test/cases/adapters/postgresql/serial_test.rb, line 37
def test_schema_dump_with_shorthand
  output = dump_table_schema "postgresql_serials"
  assert_match %r{t\.serial\s+"seq",\s+null: false$}, output
end
test_serial_column() click to toggle source
# File activerecord/test/cases/adapters/postgresql/serial_test.rb, line 23
def test_serial_column
  column = PostgresqlSerial.columns_hash["seq"]
  assert_equal :integer, column.type
  assert_equal "integer", column.sql_type
  assert column.serial?
end