diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-11-11 12:47:03 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-11-11 12:47:03 +0530 |
commit | 2e5c4717ba8aca8459637f9413b100ed58a6bcd1 (patch) | |
tree | 4e1bddb9612e44120ae6245ef77cec9f8256a9ba | |
parent | 81fad6a270ec3cbbb88553c9f2e8200c34fd4d13 (diff) | |
download | rails-2e5c4717ba8aca8459637f9413b100ed58a6bcd1.tar.gz rails-2e5c4717ba8aca8459637f9413b100ed58a6bcd1.tar.bz2 rails-2e5c4717ba8aca8459637f9413b100ed58a6bcd1.zip |
change_table bulk test case should check if the connection supports bulk alter
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index e276993508..d6c7edc461 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -1774,22 +1774,24 @@ if ActiveRecord::Base.connection.supports_migrations? Person.connection.drop_table :testings rescue nil end - def test_change_table_without_block_parameter_with_bulk - Person.connection.create_table :testings, :force => true do - string :foo - end - assert Person.connection.column_exists?(:testings, :foo, :string) + if ActiveRecord::Base.connection.supports_bulk_alter? + def test_change_table_without_block_parameter_with_bulk + Person.connection.create_table :testings, :force => true do + string :foo + end + assert Person.connection.column_exists?(:testings, :foo, :string) - assert_queries(1) do - Person.connection.change_table(:testings, :bulk => true) do - integer :bar - string :foo_bar + assert_queries(1) do + Person.connection.change_table(:testings, :bulk => true) do + integer :bar + string :foo_bar + end end - end - assert_equal %w(bar foo foo_bar id), Person.connection.columns(:testings).map { |c| c.name }.sort - ensure - Person.connection.drop_table :testings rescue nil + assert_equal %w(bar foo foo_bar id), Person.connection.columns(:testings).map { |c| c.name }.sort + ensure + Person.connection.drop_table :testings rescue nil + end end def test_change_table_should_not_have_mixed_syntax |