diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-05-16 11:25:43 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-05-16 11:25:43 -0700 |
commit | 4025efb53bc64e9b4c5b32bf7a68ef2632ffd888 (patch) | |
tree | 3622dd0bfdf41c5b7240bc25ff43307aefafbfdb /activerecord/test/cases/migration_test.rb | |
parent | 2ee8ed4e71a35bf784d6e06690ac6c6cce059734 (diff) | |
parent | 56cef492c655613fda28922917b82db23e15257e (diff) | |
download | rails-4025efb53bc64e9b4c5b32bf7a68ef2632ffd888.tar.gz rails-4025efb53bc64e9b4c5b32bf7a68ef2632ffd888.tar.bz2 rails-4025efb53bc64e9b4c5b32bf7a68ef2632ffd888.zip |
Merge pull request #6349 from erichmenge/patch-raise-type-errors
Integer limit out of range should be allowed to raise. Closes #6272
Diffstat (limited to 'activerecord/test/cases/migration_test.rb')
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index f788690b0d..cad93936c9 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -375,6 +375,27 @@ class MigrationTest < ActiveRecord::TestCase end end + def test_out_of_range_limit_should_raise + skip("MySQL and PostgreSQL only") unless current_adapter?(:MysqlAdapter, :Mysql2Adapter, :PostgreSQLAdapter) + + Person.connection.drop_table :test_limits rescue nil + 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 + 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 + end + end + + Person.connection.drop_table :test_limits rescue nil + end + protected def with_env_tz(new_tz = 'US/Eastern') old_tz, ENV['TZ'] = ENV['TZ'], new_tz @@ -883,8 +904,8 @@ class CopyMigrationsTest < ActiveRecord::TestCase def test_skipping_migrations @migrations_path = MIGRATIONS_ROOT + "/valid_with_timestamps" @existing_migrations = Dir[@migrations_path + "/*.rb"] - - sources = {} + + sources = {} sources[:bukkits] = MIGRATIONS_ROOT + "/to_copy_with_timestamps" sources[:omg] = MIGRATIONS_ROOT + "/to_copy_with_name_collision" |