Testing a Rails app (4.2) with RSpec (3.99) and Capybara (2.18). The beginning 
of the test creates a user and attempts to login to the user's account. By the 
time my Rails code gets control in the "login" module, the user has disappeared 
from the database. Here's the code in question:

@user = FactoryGirl.create :user_fully_setup
 visit root_path
 fill_in :email,     with: @user.email
 fill_in :password,  with: @user.password
 click_button

This code executes successfully (the click_button logs in the user) unless I 
add “js: true” to the test example, in which case I can see the browser window 
and it indeed fails to login (because the user is gone).

When running with Selenium, at the point before "click_button", the user still 
exists. When it hits my first "before_filter" in the controller when the 
"click_button" is executed, the user is gone (along with records in other 
tables created at the same time as the user).

I know that RSpec often runs inside a db transaction, is there any way Capybara 
could be causing the transaction to get reset?

If you’re wondering why I’m trying to run this with Selenium when it works just 
fine without it, it’s really just the first step of the test, and JS is being 
tested downstream from this part, so I will need it, just not for this part.

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/2D73D42B-CC1B-41E6-BFEE-EDECADEE128F%40pobox.com.

Reply via email to