Skip to content

Commit

Permalink
[FIX] Typo for deletion and truncation strategy (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
maniSHarma7575 authored Jun 10, 2024
1 parent 79b0876 commit 0b0bfc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
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 @@ -39,7 +39,7 @@ def 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

0 comments on commit 0b0bfc4

Please sign in to comment.