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
Use begin_transaction if connection responds to it (AR 4) #189
Conversation
Supports ActiveRecord-4.0.0.beta1
OK - we won't see what travis says because I don't think you have the PR bot set up :) @bmabey I can tell you that this solves #188 for me, but I don't know what else it breaks. If anybody else has the time/inclination/setup to verify this works and doesn't break anything else, I'd be most appreciative. |
Thanks @dchelimsky! The bot is set up and it has given this PR green. @sjmadsen, would you mind testing this PR on your Postgres setup? |
@bmabey This PR solves #187 for me. Thanks @dchelimsky! |
@sjmadsen all I did was implement your suggestion :) You're welcome! |
Use begin_transaction if connection responds to it (AR 4)
FYI, I've released |
This works great, except when switching strategies. I do this in spec_helper: config.before(:each) do
DatabaseCleaner.strategy = case Capybara.current_driver
when :rack_test ; :transaction
else ; :truncation
end
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end All tests up to the selenium ones, which use truncation, succeed. But when the strategy is switched back to transaction for the remaining "normal" tests, I get the ActiveRecord::StatementInvalid: SQLite3::SQLException: cannot start a transaction within a transaction: begin transaction. This is with v1.0.0.RC1, by the way. |
@sigvei does the same spec_helper.rb work for you with database_cleaner 0.9.1? |
@sigvei A base project with your setup on a bare rails project with the exact same dependencies would help me debug this. If you have the time please put one up on github so I can take a look. Also, I've merged in some other changes dealing with new AR changes so please try the latest from git to see if they have resolved your issue. |
Supports ActiveRecord-4.0.0.beta1
Fixes #188 and #187.
Based on the suggestion from @sjmadsen in #187.
I have not run the full test suite successfully (don't have everything set up), so let's see what travis says.