Created
June 25, 2014 22:07
-
-
Save tak1n/f224058fa92f9f4840a3 to your computer and use it in GitHub Desktop.
When testing with capybara
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make all database transactions use the same thread | |
# This is needed so tests wich uses webkit (javascript enabled feature testing) also use the same thread for database transactions | |
# Furthermore this is needed so db changes made in these feature tests are able to be rolled back | |
ActiveRecord::ConnectionAdapters::ConnectionPool.class_eval do | |
def current_connection_id | |
Thread.main.object_id | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment