aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-02-23 23:59:44 -0300
committerRafael França <rafaelmfranca@gmail.com>2016-02-23 23:59:44 -0300
commit685cf69793d7548c292b7bf9c1203f09f80f1beb (patch)
tree756383d0436d18ac4653bfce4ef00ab311813214 /activerecord
parentc9be5e088c30eedf016ce61ec7236278ac8d1cb1 (diff)
parent5d146f6e73f77f5a204157bc473583c143203092 (diff)
downloadrails-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
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/migration_test.rb22
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