Skip to content

Instantly share code, notes, and snippets.

@romanlehnert
Last active December 11, 2015 02:19
Show Gist options
  • Save romanlehnert/4529821 to your computer and use it in GitHub Desktop.
Save romanlehnert/4529821 to your computer and use it in GitHub Desktop.

Capybara upgrade information

Links

Why?

  • Abandon confusion about rack-test DSL (get, post, update, assert on request) and capybara DSL (visit, assert on page).
  • Clarify where to place tests and how to write them.

Changes

  • spec/requests is now meant to test things like an http request. Capybara is not supported any more here. Only rack-test is supported here.
  • spec/features is new and should contain browser based tests from the users point of view. It does not have rack-test dsl but capybara DSL loaded.
  • spec/api has only rack-test DSL loaded.
  • Ambiguous elements raise an error now. The search term must be exact
  • has_content? now reflects css rule text-transform: uppercase. see here. Rack-test still does not reflect this.
  • has_content? matches only visible elements
  • page dies not match for elements within . use page.body.should have_selector "head title" to test page title.

Update

bundle update capybara capybara-webkit capybara-email rspec-rails

Possible fixes:

Take them to the right place

Take a look at spec/acceptance. All the tests that use capybara should move to spec/features.

ambiguous

Define the searchterms for elements exactly because ambiguous elements will raise.

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