aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-06-03 16:17:59 +0200
committerYves Senn <yves.senn@gmail.com>2014-06-03 16:17:59 +0200
commitfcd5e56b862ffea9a8c1cea0c622472c5346474b (patch)
tree8fad1200ad20cc9d913163eafeb261d18c4afc41 /activerecord/test/cases/adapters/postgresql
parent51f247107f63b8c6c3a2ba689d26b3ed51237ab2 (diff)
downloadrails-fcd5e56b862ffea9a8c1cea0c622472c5346474b.tar.gz
rails-fcd5e56b862ffea9a8c1cea0c622472c5346474b.tar.bz2
rails-fcd5e56b862ffea9a8c1cea0c622472c5346474b.zip
pg, preserve type when schema dumping bit and bit varying columns.
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql')
-rw-r--r--activerecord/test/cases/adapters/postgresql/bit_string_test.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/bit_string_test.rb b/activerecord/test/cases/adapters/postgresql/bit_string_test.rb
index 2ca97eabab..8e88acf4db 100644
--- a/activerecord/test/cases/adapters/postgresql/bit_string_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/bit_string_test.rb
@@ -13,8 +13,8 @@ class PostgresqlBitStringTest < ActiveRecord::TestCase
@connection = ActiveRecord::Base.connection
@connection.transaction do
@connection.create_table('postgresql_bit_strings') do |t|
- t.column :a_bit, "bit(8)", default: "00000011"
- t.column :a_bit_varying, "bit varying", default: "0011"
+ t.bit :a_bit, default: "00000011", limit: 8
+ t.bit_varying :a_bit_varying, default: "0011"
end
end
end
@@ -25,9 +25,9 @@ class PostgresqlBitStringTest < ActiveRecord::TestCase
def test_bit_string_column
column = PostgresqlBitString.columns_hash["a_bit"]
- assert_equal :string, column.type
+ assert_equal :bit, column.type
assert_equal "bit(8)", column.sql_type
- assert column.text?
+ assert_not column.text?
assert_not column.number?
assert_not column.binary?
assert_not column.array
@@ -35,9 +35,9 @@ class PostgresqlBitStringTest < ActiveRecord::TestCase
def test_bit_string_varying_column
column = PostgresqlBitString.columns_hash["a_bit_varying"]
- assert_equal :string, column.type
+ assert_equal :bit_varying, column.type
assert_equal "bit varying", column.sql_type
- assert column.text?
+ assert_not column.text?
assert_not column.number?
assert_not column.binary?
assert_not column.array
@@ -53,8 +53,8 @@ class PostgresqlBitStringTest < ActiveRecord::TestCase
def test_schema_dumping
output = dump_table_schema("postgresql_bit_strings")
- assert_match %r{t\.string\s+"a_bit",\s+default: "00000011"$}, output
- assert_match %r{t\.string\s+"a_bit_varying",\s+default: "0011"$}, output
+ assert_match %r{t\.bit\s+"a_bit",\s+default: "00000011"$}, output
+ assert_match %r{t\.bit_varying\s+"a_bit_varying",\s+default: "0011"$}, output
end
def test_assigning_invalid_hex_string_raises_exception