Skip to content

Instantly share code, notes, and snippets.

@Micka33
Last active August 29, 2015 14:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Micka33/18f767da00c42998d5bc to your computer and use it in GitHub Desktop.
Save Micka33/18f767da00c42998d5bc to your computer and use it in GitHub Desktop.
Rspec - capybara

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment