If you want to do integration test you had better use
capybara-webkit instead of
You need to add database_cleaner. It makes database clean every test case.
Database clear vs Shared Connection
http://robots.thoughtbot.com/ said that…
There are 2 ways to use same data between capybara and capybara-webkit threads.
- one is that commit all data and use it between 2 threads. after each test all of data is deleted.
- another is taht share the database connection between 2 threads.
- comment in to load
use_transactional_fixturesto commit all queries in testcase. It makes capybara and capybara-webkit use same data.
- If you want to know detail you should check this article.
- add this file as
spec/support/database_cleaner.rbto clear database every test.
- add this WaitForAjax module as
spec/support/wait_for_ajax.rbto wait ajax request callback.
- add spec file as
js: trueoption to scenario function
wait_for_ajaxfunction after ajax trigger(e.g. click)
I created integration test useing capybara-webkit.
- clone and checkout
- add qt for capybara-webkit
- update gems
- execute test