Skip to content

Commit

Permalink
Merge pull request #2807 from johnpitchko/specify-default-system-spec…
Browse files Browse the repository at this point in the history
…-driver

Explain how to set a default driver for system specs
  • Loading branch information
JonRowe authored Oct 9, 2024
2 parents ab36146 + f915410 commit cf0078d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion features/system_specs/system_specs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,21 @@ 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 need to call `driven_by` in your specs.

This can either be done manually in the spec files themselves or
you can use the configuration helpers to do this for every system spec,
for example by adding the following to `spec/rails_helper.rb`:

```ruby
RSpec.configure do |config|
...
config.before(type: :system) do
driven_by :selenium_headless # Or your preferred default driver
end
...
end
```

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

0 comments on commit cf0078d

Please sign in to comment.