Q:

Omniauth Test Mock Doesn't Work When Using Capybara-webkit Driver

I'm trying to use Capybara with MiniTest and the capybara-webkit driver to test a page from a Rails 4 app, with Omniauth login and simple Javascript on it. I've set up the Omniauth mock as described here: https://github.com/intridea/omniauth/wiki/Integration-Testing, and it works fine for Capybara tests with the default rack driver.
I enable the capybara-webkit driver at the beginning of the test case:
Capybara.current_driver = :webkit

Then, I click on the link for the provider I've mocked, and check that I got through the authentication to the user's home page:
click_on('Google')
assert_equal home_user_path(@user), current_path

The assertion fails with:
Expected: "/users/407557848/home"
  Actual: "/auth/google_oauth2/callback"

The actual string is the URL that (mock) Google is calling back to, with the authentication. It should get routed to my sessions controller to set up the session, and does with other test cases using the rack driver.
Any idea what I'm doing wrong?

A:

Turns out this was because the webkit driver runs the server in a different thread. One thread had the database locked, so the other thread couldn't do what it needed to do to log me in. To fix it, I stopped using transactional fixtures:
class TeamBuildingTest < ActionDispatch::IntegrationTest
  self.use_transactional_fixtures = false
...

Then I used the database_cleaner gem to clean out my database. This was a case where trying to take baby steps caused me more grief rather than less (I was trying to avoid having to learn yet another gem while I was trying to learn Capybara and Javascript).
I found this link helpful alongside the database_cleaner documentation.

