diff options
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/bit_string_test.rb | 16 |
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 8e88acf4db..d63750a3ea 100644 --- a/activerecord/test/cases/adapters/postgresql/bit_string_test.rb +++ b/activerecord/test/cases/adapters/postgresql/bit_string_test.rb @@ -14,7 +14,7 @@ class PostgresqlBitStringTest < ActiveRecord::TestCase @connection.transaction do @connection.create_table('postgresql_bit_strings') do |t| t.bit :a_bit, default: "00000011", limit: 8 - t.bit_varying :a_bit_varying, default: "0011" + t.bit_varying :a_bit_varying, default: "0011", limit: 4 end end end @@ -36,7 +36,7 @@ class PostgresqlBitStringTest < ActiveRecord::TestCase def test_bit_string_varying_column column = PostgresqlBitString.columns_hash["a_bit_varying"] assert_equal :bit_varying, column.type - assert_equal "bit varying", column.sql_type + assert_equal "bit varying(4)", column.sql_type assert_not column.text? assert_not column.number? assert_not column.binary? @@ -53,8 +53,8 @@ class PostgresqlBitStringTest < ActiveRecord::TestCase def test_schema_dumping output = dump_table_schema("postgresql_bit_strings") - 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 + assert_match %r{t\.bit\s+"a_bit",\s+limit: 8,\s+default: "00000011"$}, output + assert_match %r{t\.bit_varying\s+"a_bit_varying",\s+limit: 4,\s+default: "0011"$}, output end def test_assigning_invalid_hex_string_raises_exception @@ -63,17 +63,17 @@ class PostgresqlBitStringTest < ActiveRecord::TestCase end def test_roundtrip - PostgresqlBitString.create! a_bit: "00001010", a_bit_varying: "00010101" + PostgresqlBitString.create! a_bit: "00001010", a_bit_varying: "0101" record = PostgresqlBitString.first assert_equal "00001010", record.a_bit - assert_equal "00010101", record.a_bit_varying + assert_equal "0101", record.a_bit_varying record.a_bit = "11111111" - record.a_bit_varying = "0xFF" + record.a_bit_varying = "0xF" record.save! assert record.reload assert_equal "11111111", record.a_bit - assert_equal "11111111", record.a_bit_varying + assert_equal "1111", record.a_bit_varying end end |