I figured out the main reason my specs were failing when I replaced cleaner with rewinder: the sqlite3 adapter changes the relative path of the db file in config/database.yml to an absolute path, so c.db == database evaluates to false in record_inserted_table.
I've added a few lines to compare absolute paths in the case where the adapter is sqlite3 and we're not using :memory:, and a spec that checks this. Maybe there's a cleaner way to do this, but anyway this works.
I figured out the main reason my specs were failing when I replaced cleaner with rewinder: the sqlite3 adapter changes the relative path of the db file in
config/database.yml
to an absolute path, soc.db == database
evaluates to false inrecord_inserted_table
.Here's the relevant line in activerecord:
https://github.com/rails/rails/blob/f13b278568a1d629dd4d90b16ed87b715c4e689d/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L21
I've added a few lines to compare absolute paths in the case where the adapter is
sqlite3
and we're not using:memory:
, and a spec that checks this. Maybe there's a cleaner way to do this, but anyway this works.