diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-02-23 23:59:44 -0300 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-02-23 23:59:44 -0300 |
commit | 685cf69793d7548c292b7bf9c1203f09f80f1beb (patch) | |
tree | 756383d0436d18ac4653bfce4ef00ab311813214 | |
parent | c9be5e088c30eedf016ce61ec7236278ac8d1cb1 (diff) | |
parent | 5d146f6e73f77f5a204157bc473583c143203092 (diff) | |
download | rails-685cf69793d7548c292b7bf9c1203f09f80f1beb.tar.gz rails-685cf69793d7548c292b7bf9c1203f09f80f1beb.tar.bz2 rails-685cf69793d7548c292b7bf9c1203f09f80f1beb.zip |
Merge pull request #23842 from kamipo/drop_table_test_text_limits_as_well
`drop_table :test_text_limits` as well
-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 |