diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2016-02-24 10:39:07 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2016-02-24 10:39:07 +0900 |
commit | 5d146f6e73f77f5a204157bc473583c143203092 (patch) | |
tree | d101284a7328fb3ed216e4851ae0db295ba79c8f /activerecord/test/cases | |
parent | f6e5b6075f0b02400c066c0630822be8785742f3 (diff) | |
download | rails-5d146f6e73f77f5a204157bc473583c143203092.tar.gz rails-5d146f6e73f77f5a204157bc473583c143203092.tar.bz2 rails-5d146f6e73f77f5a204157bc473583c143203092.zip |
`drop_table :test_text_limits` as well
Follow up to 3b01785.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 4566aeb45b..c88e8d4a8b 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -586,9 +586,7 @@ class MigrationTest < ActiveRecord::TestCase end if current_adapter?(:Mysql2Adapter, :PostgreSQLAdapter) - def test_out_of_range_limit_should_raise - Person.connection.drop_table :test_integer_limits, if_exists: true - + def test_out_of_range_integer_limit_should_raise e = assert_raise(ActiveRecord::ActiveRecordError, "integer limit didn't raise") do Person.connection.create_table :test_integer_limits, :force => true do |t| t.column :bigone, :integer, :limit => 10 @@ -596,16 +594,22 @@ class MigrationTest < ActiveRecord::TestCase end assert_match(/No integer type has byte size 10/, e.message) + ensure + Person.connection.drop_table :test_integer_limits, if_exists: true + end + end - unless current_adapter?(:PostgreSQLAdapter) - assert_raise(ActiveRecord::ActiveRecordError, "text limit didn't raise") do - Person.connection.create_table :test_text_limits, :force => true do |t| - t.column :bigtext, :text, :limit => 0xfffffffff - end + if current_adapter?(:Mysql2Adapter) + def test_out_of_range_text_limit_should_raise + e = assert_raise(ActiveRecord::ActiveRecordError, "text limit didn't raise") do + Person.connection.create_table :test_text_limits, force: true do |t| + t.text :bigtext, limit: 0xfffffffff end end + + assert_match(/No text type has byte length #{0xfffffffff}/, e.message) ensure - Person.connection.drop_table :test_integer_limits, if_exists: true + Person.connection.drop_table :test_text_limits, if_exists: true end end |