Skip to content

Commit 7b992b0

Browse files
authored
Merge branch 'main' into fixes-120-pre-count-truncate-with-options
2 parents 567f0b8 + 3748bab commit 7b992b0

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Development (unreleased)
22

3+
* Provide a 'Changelog' link on Rubygems: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/114
34
* Fix bundling and CONTRIBUTE.md instructions: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/123
45
* https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/121 by @etagwerker
6+
* Fix order of arguments in `truncate_tables` expectation https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/124
57

68
## v2.2.1 2025-05-13
79

@@ -28,4 +30,4 @@
2830

2931
* Add Ruby 3.2 to CI matrix: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/79
3032
* Add Rails 7.1 support: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/78
31-
* Add WHERE clause to make `ruby-spanner-activerecord` happy: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/77
33+
* Add WHERE clause to make `ruby-spanner-activerecord` happy: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/77

database_cleaner-active_record.gemspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ Gem::Specification.new do |spec|
2929
spec.add_development_dependency "pg"
3030
spec.add_development_dependency "sqlite3"
3131
spec.add_development_dependency "trilogy"
32+
33+
spec.metadata["changelog_uri"] = spec.homepage + "/blob/main/CHANGELOG.md"
3234
end

spec/database_cleaner/active_record/truncation_spec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@
106106
it "specifies cascade when truncating" do
107107
User.create!({name: 1})
108108

109-
expect(strategy.send(:connection)).to receive(:truncate_tables).with(['users', 'agents'].sort, {truncate_option: :cascade})
109+
tables_to_truncate = ["agents", "users"]
110+
tables_to_truncate << "user_profiles" if helper.db == :postgres
111+
112+
expect(strategy.send(:connection)).to receive(:truncate_tables).with(array_including(tables_to_truncate), {truncate_option: :cascade})
110113
strategy.clean
111114
end
112115
end
@@ -117,7 +120,10 @@
117120
it "specifies restrict when truncating" do
118121
User.create!
119122

120-
expect(strategy.send(:connection)).to receive(:truncate_tables).with(['users', 'agents'].sort, {truncate_option: :restrict})
123+
tables_to_truncate = ["agents", "users"]
124+
tables_to_truncate << "user_profiles" if helper.db == :postgres
125+
126+
expect(strategy.send(:connection)).to receive(:truncate_tables).with(array_including(tables_to_truncate), {truncate_option: :restrict})
121127
strategy.clean
122128
end
123129
end

0 commit comments

Comments
 (0)