问题
I am running Sinatra, Capybara and RSpec. I am testing javascript interactions with webkit headless browser. I am using factory girl to create data that I need to be present for my test. I then use capybara to perform interactions with my application. During these interactions the data that I created at the start of the test is no longer available. It's created with no issue however when debugging in the controller the database is empty. Why is my database empty in the controller but not in the spec that interacts with the contorller?
回答1:
Try to read this article (the 3rd point). I think the problem is connected with DB transactions.
You can search a lot of additional info by words rails rspec shared connection
来源:https://stackoverflow.com/questions/18905748/capybara-server-cant-access-data-created-in-a-spec