Skip to content

Commit cf0078d

Browse files
authored
Merge pull request #2807 from johnpitchko/specify-default-system-spec-driver
Explain how to set a default driver for system specs
2 parents ab36146 + f915410 commit cf0078d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

features/system_specs/system_specs.feature

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,21 @@ Feature: System specs
1919

2020
RSpec **does not** use your `ApplicationSystemTestCase` helper. Instead it
2121
uses the default `driven_by(:selenium)` from Rails. If you want to override
22-
this behaviour you can call `driven_by` manually in a test.
22+
this behaviour you need to call `driven_by` in your specs.
23+
24+
This can either be done manually in the spec files themselves or
25+
you can use the configuration helpers to do this for every system spec,
26+
for example by adding the following to `spec/rails_helper.rb`:
27+
28+
```ruby
29+
RSpec.configure do |config|
30+
...
31+
config.before(type: :system) do
32+
driven_by :selenium_headless # Or your preferred default driver
33+
end
34+
...
35+
end
36+
```
2337

2438
System specs run in a transaction. So unlike feature specs with
2539
javascript, you do not need [DatabaseCleaner](https://github.com/DatabaseCleaner/database_cleaner).

0 commit comments

Comments
 (0)