From 87535f50e92f7567d817b455e4f7f4a44371710f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Sat, 24 Dec 2005 16:55:55 +0000 Subject: SchemaDumper now doesn't fail anymore when there are unknown column types in the schema. Instead the table is ignored and a Comment is left in the schema.rb also added ActiveRecord::Base.schema_ignore_tables for dealing with funky tables like the tesearch2 ones. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3346 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/schema_dumper_test.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'activerecord/test/schema_dumper_test.rb') diff --git a/activerecord/test/schema_dumper_test.rb b/activerecord/test/schema_dumper_test.rb index e24724c9f8..cc6a941554 100644 --- a/activerecord/test/schema_dumper_test.rb +++ b/activerecord/test/schema_dumper_test.rb @@ -14,6 +14,38 @@ if ActiveRecord::Base.connection.respond_to?(:tables) assert_match %r{create_table "authors"}, output assert_no_match %r{create_table "schema_info"}, output end + + def test_schema_dump_with_string_ignored_table + stream = StringIO.new + + ActiveRecord::Base.schema_ignore_tables = ['accounts'] + ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream) + output = stream.string + assert_no_match %r{create_table "accounts"}, output + assert_match %r{create_table "authors"}, output + assert_no_match %r{create_table "schema_info"}, output + end + + + def test_schema_dump_with_regexp_ignored_table + stream = StringIO.new + + ActiveRecord::Base.schema_ignore_tables = [/^account/] + ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream) + output = stream.string + assert_no_match %r{create_table "accounts"}, output + assert_match %r{create_table "authors"}, output + assert_no_match %r{create_table "schema_info"}, output + end + + + def test_schema_dump_illegal_ignored_table_value + stream = StringIO.new + ActiveRecord::Base.schema_ignore_tables = [5] + assert_raise(StandardError) do + ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream) + end + end end end -- cgit v1.2.3