Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Typo for deletion strategy #94

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/database_cleaner/active_record/deletion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class Deletion < Truncation
def clean
connection.disable_referential_integrity do
if pre_count? && connection.respond_to?(:pre_count_tables)
delete_tables(connection, connection.pre_count_tables(tables_to_truncate(connection)))
delete_tables(connection, connection.pre_count_tables(tables_to_clean(connection)))
else
delete_tables(connection, tables_to_truncate(connection))
delete_tables(connection, tables_to_clean(connection))
end
end
end
Expand Down Expand Up @@ -40,7 +40,7 @@ def reset_id_sequence connection, table_name
end
end

def tables_to_truncate(connection)
def tables_to_clean(connection)
if information_schema_exists?(connection)
@except += connection.database_cleaner_view_cache + migration_storage_names
(@only.any? ? @only : tables_with_new_rows(connection)) - @except
Expand Down
6 changes: 3 additions & 3 deletions lib/database_cleaner/active_record/truncation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def initialize(opts={})
def clean
connection.disable_referential_integrity do
if pre_count? && connection.respond_to?(:pre_count_truncate_tables)
connection.pre_count_truncate_tables(tables_to_truncate(connection))
connection.pre_count_truncate_tables(tables_to_clean(connection))
else
connection.truncate_tables(tables_to_truncate(connection))
connection.truncate_tables(tables_to_clean(connection))
end
end
end
Expand All @@ -33,7 +33,7 @@ def connection
@connection ||= ConnectionWrapper.new(connection_class.connection)
end

def tables_to_truncate(connection)
def tables_to_clean(connection)
if @only.none?
all_tables = cache_tables? ? connection.database_cleaner_table_cache : connection.database_tables
@only = all_tables.map { |table| table.split(".").last }
Expand Down