Rails System Tests

  • To test client side (browser)
  • Easier to configure capybara and webdriver
  • Rails System Tests run the driver in Rails process so less database issues
  • RSpec.describe "Your Test", type: :system do
  • Tests live in spec/system/

Minimum setup

group :test do
  gem "capybara"
  gem "selenium-webdriver"
  gem "webdrivers"
end

RSpec.configure do |config|
  config.before(:each, type: :system) do
    driven_by :rack_test
  end

  config.before(:each, type: :system, js: true) do
    driven_by :selenium_chrome
  end
end