2

I've seen both usages: As in say im testing a web app using Capybara/Rspec?

I seen it edited in the spec_helper.rb file:

'require capybara/rspec'
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist

for example.

I also see it not placed there and put in each individual test....

Is there a "best practices" for this? Since you can switch between drivers in Capybara does it make sense to keep all the requires in one spot?

Thanks!

1

I think it depends largely on:

  • whether this is a standalone testing app or part of a rails application.
  • if part of a rails application, which rails version was originally / currently used.

In rails applications it's now usually placed in spec/support/capybara.rb:, e.g. Capybara.javascript_driver = :selenium

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.