From 2e5c4717ba8aca8459637f9413b100ed58a6bcd1 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Fri, 11 Nov 2011 12:47:03 +0530 Subject: change_table bulk test case should check if the connection supports bulk alter --- activerecord/test/cases/migration_test.rb | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'activerecord/test/cases') 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 -- cgit v1.2.3