提交 17efb3b9 编写于 作者: S Sean Griffin

Remove is_a? check when ignoring tables

Technically changes the API, as it will allow any object which responds
to `===`. Personally, I think this is more flexible.
上级 f767ac22
......@@ -244,12 +244,7 @@ def remove_prefix_and_suffix(table)
def ignored?(table_name)
['schema_migrations', ignore_tables].flatten.any? do |ignored|
case ignored
when String; remove_prefix_and_suffix(table_name) == ignored
when Regexp; remove_prefix_and_suffix(table_name) =~ ignored
else
raise StandardError, 'ActiveRecord::SchemaDumper.ignore_tables accepts an array of String and / or Regexp values.'
end
ignored === remove_prefix_and_suffix(table_name)
end
end
end
......
......@@ -162,16 +162,6 @@ def test_schema_dump_with_regexp_ignored_table
assert_no_match %r{create_table "schema_migrations"}, output
end
def test_schema_dump_illegal_ignored_table_value
stream = StringIO.new
old_ignore_tables, ActiveRecord::SchemaDumper.ignore_tables = ActiveRecord::SchemaDumper.ignore_tables, [5]
assert_raise(StandardError) do
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
end
ensure
ActiveRecord::SchemaDumper.ignore_tables = old_ignore_tables
end
def test_schema_dumps_index_columns_in_right_order
index_definition = standard_dump.split(/\n/).grep(/add_index.*companies/).first.strip
if current_adapter?(:MysqlAdapter, :Mysql2Adapter, :PostgreSQLAdapter)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册