1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

use skip rather than conditionally define tests

This commit is contained in:
Aaron Patterson 2012-01-11 15:58:58 -08:00
parent c0c7ba9d41
commit ee4e24244b

View file

@ -87,7 +87,8 @@ class MigrationTest < ActiveRecord::TestCase
end
def test_rename_index
unless current_adapter?(:OpenBaseAdapter)
skip "not supported on openbase" if current_adapter?(:OpenBaseAdapter)
# keep the names short to make Oracle and similar behave
Person.connection.add_index('people', [:first_name], :name => 'old_idx')
assert_nothing_raised { Person.connection.rename_index('people', 'old_idx', 'new_idx') }
@ -95,14 +96,13 @@ class MigrationTest < ActiveRecord::TestCase
assert !Person.connection.index_name_exists?('people', 'old_idx', false)
assert Person.connection.index_name_exists?('people', 'new_idx', true)
end
end
def test_double_add_index
unless current_adapter?(:OpenBaseAdapter)
skip "not supported on openbase" if current_adapter?(:OpenBaseAdapter)
Person.connection.add_index('people', [:first_name], :name => 'some_idx')
assert_raise(ArgumentError) { Person.connection.add_index('people', [:first_name], :name => 'some_idx') }
end
end
def test_create_table_with_force_true_does_not_drop_nonexisting_table
if Person.connection.table_exists?(:testings2)
@ -182,8 +182,9 @@ class MigrationTest < ActiveRecord::TestCase
# Test SQLite adapter specifically for decimal types with precision and scale
# attributes, since these need to be maintained in schema but aren't actually
# used in SQLite itself
if current_adapter?(:SQLite3Adapter)
def test_change_column_with_new_precision_and_scale
skip "only on sqlite3" unless current_adapter?(:SQLite3Adapter)
Person.delete_all
Person.connection.add_column 'people', 'wealth', :decimal, :precision => 9, :scale => 7
Person.reset_column_information
@ -197,6 +198,8 @@ class MigrationTest < ActiveRecord::TestCase
end
def test_change_column_preserve_other_column_precision_and_scale
skip "only on sqlite3" unless current_adapter?(:SQLite3Adapter)
Person.delete_all
Person.connection.add_column 'people', 'last_name', :string
Person.connection.add_column 'people', 'wealth', :decimal, :precision => 9, :scale => 7
@ -213,7 +216,6 @@ class MigrationTest < ActiveRecord::TestCase
assert_equal 9, wealth_column.precision
assert_equal 7, wealth_column.scale
end
end
def test_native_types
Person.delete_all
@ -288,8 +290,9 @@ class MigrationTest < ActiveRecord::TestCase
assert_kind_of BigDecimal, bob.wealth
end
if current_adapter?(:MysqlAdapter) or current_adapter?(:Mysql2Adapter)
def test_unabstracted_database_dependent_types
skip "not supported" unless current_adapter?(:MysqlAdapter, :Mysql2Adapter)
Person.delete_all
ActiveRecord::Migration.add_column :people, :intelligence_quotient, :tinyint
@ -298,7 +301,6 @@ class MigrationTest < ActiveRecord::TestCase
ensure
ActiveRecord::Migration.remove_column :people, :intelligence_quotient rescue nil
end
end
def test_add_remove_single_field_using_string_arguments
assert !Person.column_methods_hash.include?(:last_name)
@ -472,8 +474,9 @@ class MigrationTest < ActiveRecord::TestCase
end
end
if current_adapter?(:SQLite3Adapter)
def test_rename_table_for_sqlite_should_work_with_reserved_words
skip "not supported" unless current_adapter?(:SQLite3Adapter)
begin
assert_nothing_raised do
ActiveRecord::Base.connection.rename_table :references, :old_references
@ -496,7 +499,6 @@ class MigrationTest < ActiveRecord::TestCase
ActiveRecord::Base.connection.rename_table :old_references, :references
end
end
end
def test_rename_table
begin
@ -1138,7 +1140,7 @@ class MigrationTest < ActiveRecord::TestCase
end
def test_create_table_with_custom_sequence_name
return unless current_adapter? :OracleAdapter
skip "not supported" unless current_adapter? :OracleAdapter
# table name is 29 chars, the standard sequence name will
# be 33 chars and should be shortened