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

truncation and deletion doesn't call after_commit #87

Open
tomocrafter opened this issue Jun 6, 2023 · 0 comments
Open

truncation and deletion doesn't call after_commit #87

tomocrafter opened this issue Jun 6, 2023 · 0 comments

Comments

@tomocrafter
Copy link

Currently, I am using the deletion strategy in request testing. With the transaction strategy, I cannot access the models that the controller creates during the test (possibly because it's in a different thread?).

The models created during the test have an after_commit callback set, which includes a process to delete the index from Elasticsearch when the model is deleted. However, database_cleaner does perform the deletion but it does not call the after_commit callback.

connection.execute("DELETE FROM #{connection.quote_table_name(table_name)} WHERE 1=1")

How can I get the after_commit callback to be called, or make the request test work with the transaction strategy?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant