aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/migration_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/migration_test.rb')
-rw-r--r--activerecord/test/migration_test.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb
index 355c459818..10cab682df 100644
--- a/activerecord/test/migration_test.rb
+++ b/activerecord/test/migration_test.rb
@@ -425,14 +425,26 @@ if ActiveRecord::Base.connection.supports_migrations?
end
def test_change_column_with_new_default
- Person.connection.add_column "people", "administrator", :boolean, :default => 1
+ Person.connection.add_column "people", "administrator", :boolean, :default => true
Person.reset_column_information
assert Person.new.administrator?
- assert_nothing_raised { Person.connection.change_column "people", "administrator", :boolean, :default => 0 }
+ assert_nothing_raised { Person.connection.change_column "people", "administrator", :boolean, :default => false }
Person.reset_column_information
assert !Person.new.administrator?
end
+
+ def test_change_column_default
+ Person.connection.change_column_default "people", "first_name", "Tester"
+ Person.reset_column_information
+ assert_equal "Tester", Person.new.first_name
+ end
+
+ def test_change_column_default_to_null
+ Person.connection.change_column_default "people", "first_name", nil
+ Person.reset_column_information
+ assert_nil Person.new.first_name
+ end
def test_add_table
assert !Reminder.table_exists?