diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-15 02:22:53 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-15 02:22:53 +0000 |
commit | 6019c268562d3d1e62c3ad649e81a1803f3e0732 (patch) | |
tree | 4fbad66ece81acb10c8d7a705339565c3ae6c459 /activerecord/test/migration_test.rb | |
parent | a491f928608f763cf4fa6067f7cf9529197afcae (diff) | |
download | rails-6019c268562d3d1e62c3ad649e81a1803f3e0732.tar.gz rails-6019c268562d3d1e62c3ad649e81a1803f3e0732.tar.bz2 rails-6019c268562d3d1e62c3ad649e81a1803f3e0732.zip |
change_column accepts :default => nil. Closes #6956.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5937 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/migration_test.rb')
-rw-r--r-- | activerecord/test/migration_test.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb index 10cab682df..825244d88e 100644 --- a/activerecord/test/migration_test.rb +++ b/activerecord/test/migration_test.rb @@ -94,8 +94,10 @@ if ActiveRecord::Base.connection.supports_migrations? end def test_create_table_with_not_null_column - Person.connection.create_table :testings do |t| - t.column :foo, :string, :null => false + assert_nothing_raised do + Person.connection.create_table :testings do |t| + t.column :foo, :string, :null => false + end end assert_raises(ActiveRecord::StatementInvalid) do @@ -423,6 +425,17 @@ if ActiveRecord::Base.connection.supports_migrations? assert new_columns.find { |c| c.name == 'approved' and c.type == :boolean and c.default == false } assert_nothing_raised { Topic.connection.change_column :topics, :approved, :boolean, :default => true } end + + def test_change_column_with_nil_default + Person.connection.add_column "people", "contributor", :boolean, :default => true + Person.reset_column_information + assert Person.new.contributor? + + assert_nothing_raised { Person.connection.change_column "people", "contributor", :boolean, :default => nil } + Person.reset_column_information + assert !Person.new.contributor? + assert_nil Person.new.contributor + end def test_change_column_with_new_default Person.connection.add_column "people", "administrator", :boolean, :default => true |