Skip to content
Discussion options

You must be logged in to vote

Hello @serggiu.

I moved this to the discussions tab as it's more of a question than a bug.

The most likely reason you're seeing this behaviour in your test case is you have transactional fixtures in your test config or, if you're using the database_cleaner gem, your test database is being cleaned with the :transaction strategy.

Anything inside a transaction will always go to the primary (as it makes no sense to open a transaction in a replica).

So your test case should work if you don't wrap your test cases in transactions. You could use truncation instead.

Although I'm not sure what you're trying to achieve with that test case. It's not usually advised to write tests for third party code…

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@serggiu
Comment options

@mateuscruz
Comment options

@serggiu
Comment options

@mateuscruz
Comment options

Answer selected by mateuscruz
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mateuscruz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #182 on November 05, 2025 05:35.