I recently switched a very simple rails app from rspec to minitest. I also use capybara and factory_girl.
I have 3 separate integration test files, all of which involve logging the user in using something along the lines of:
before(:each) do
user = Factory(:user)
visit login_path
fill_in "Email", :with => user.email
fill_in "Password", :with => user.password
click_button "Log in"
end
After I switched to minitest, it seems as if the sessions ceased to tear down after each test. For instance, I would test login using the above code in a test file named “users_integration_test.rb” and when it begins running another test file, say “sessions_integration_test.rb”, the user is already logged in before I can log in again using the above code.
My question is: Is this an intentional difference between rspec and minitest, and I simply need to logout the user after each test? Or did I make a mistake setting up minitest?
I am using the same minitest_helper file as in the Minitest Railscast.
I got it to tear down correctly with this. Hope it helps!
Mr. Maeshima’s answer may very well work too. I have not tried.