From 641ebbbc936699ea3744290fdbdcbd53765172dd Mon Sep 17 00:00:00 2001 From: John Pitchko Date: Thu, 3 Oct 2024 21:09:03 -0600 Subject: [PATCH] Explain how to set a default driver for system specs --- features/system_specs/system_specs.feature | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/features/system_specs/system_specs.feature b/features/system_specs/system_specs.feature index bb729ac3f..7cb11715b 100644 --- a/features/system_specs/system_specs.feature +++ b/features/system_specs/system_specs.feature @@ -19,7 +19,15 @@ Feature: System specs RSpec **does not** use your `ApplicationSystemTestCase` helper. Instead it uses the default `driven_by(:selenium)` from Rails. If you want to override - this behaviour you can call `driven_by` manually in a test. + this behaviour you can call `driven_by` manually in a test. Alternatively, + if you want to specify a default driver for all system specs (rather than + using `driven_by` in every spec), add the following to `spec/rails_helper.rb`: + + ``` + config.before(type: :system) do + driven_by :selenium_headless # Or your preferred default driver + end + ``` System specs run in a transaction. So unlike feature specs with javascript, you do not need [DatabaseCleaner](https://github.com/DatabaseCleaner/database_cleaner).