File tree Expand file tree Collapse file tree
spec/database_cleaner/active_record Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33* Provide a 'Changelog' link on Rubygems: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/114
44* Fix bundling and CONTRIBUTE.md instructions: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/123
5+ * Fix order of arguments in ` truncate_tables ` expectation https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/124
56
67## v2.2.1 2025-05-13
78
Original file line number Diff line number Diff line change 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' ] , { 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
117120 it "specifies restrict when truncating" do
118121 User . create!
119122
120- expect ( strategy . send ( :connection ) ) . to receive ( :truncate_tables ) . with ( [ 'users' , 'agents' ] , { 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
You can’t perform that action at this time.
0 commit comments