How to write it : http://betterspecs.org/
rpsec helper methods : https://www.relishapp.com/rspec/rspec-core/docs/helper-methods/define-helper-methods-in-a-module
A screen cast Rspec/Capybara : http://railscasts.com/episodes/275-how-i-test
Capybara stuff : https://github.com/jnicklas/capybara
- Using Capybara with RSpec
- Drivers
- Navigating
- Clicking links and buttons
- Interacting with forms
- Querying
- Finding
- Scoping
- Working with windows
- Scripting
- Modals
- Debugging
- Exactness
- Strategy
- Transactions and database setup
- Asynchronous JavaScript (Ajax and friends)
- Using the sessions manually
- XPath, CSS and selectors
- Configuring and adding drivers
controllers specs VS requests specs : http://stackoverflow.com/questions/12435800/ruby-on-rails-3-rspec-capybara-check-response-status
capybara-webkit: https://github.com/thoughtbot/capybara-webkit Set your Capybara Javascript driver to webkit:
Capybara.javascript_driver = :webkit
In cucumber, tag scenarios with @javascript to run them using a headless WebKit browser.
In RSpec, use the :js => true
flag. See the capybara documentation for more information about using capybara with RSpec.
Take note of the transactional fixtures section of the capybara README.