Skip to content

Commit 3bf7098

Browse files
committed
Apply more fixes per @JonRowe's review
1 parent db1fdf7 commit 3bf7098

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
`rspec-rails` brings the [RSpec][] testing framework to [Ruby on Rails][]
44
as a drop-in alternative to its default testing framework, Minitest.
55

6-
In RSpec, tests are not just scripts that verify your application code;
7-
they’re also detailed explanations of how the application is supposed to behave,
8-
expressed in plain Englishin other words, _specs._
6+
In RSpec, tests are not just scripts that verify your application code.
7+
They’re also detailed explanations of how the application is supposed to behave,
8+
expressed in plain English; in other words, _specs._
99

1010
Use **[`rspec-rails` 1.x][]** for Rails 2.x.
1111

@@ -37,6 +37,9 @@ Use **[`rspec-rails` 1.x][]** for Rails 2.x.
3737
end
3838
```
3939

40+
(Adding it to the `:development` group is not strictly necessary,
41+
but without it, generators and rake tasks must be preceded by `RAILS_ENV=test`.)
42+
4043
2. Then, in your project directory:
4144

4245
```sh
@@ -290,26 +293,32 @@ and the expectations revolve around page content.
290293

291294
Because system specs are a wrapper around Rails’ built-in `SystemTestCase`,
292295
they’re only available on Rails 5.1+.
296+
(Feature specs serve the same purpose, but without this dependency.)
293297

294298
#### Feature specs
295299

296-
Feature specs serve the same purpose,
297-
but `SystemTestCase` solves some longstanding configuration issues they had,
298-
so the RSpec team [officially recommends system specs][] over feature specs.
300+
Before Rails introduced system testing facilities,
301+
feature specs were the only spec type for end-to-end testing.
302+
While the RSpec team now [officially recommends system specs][] instead,
303+
feature specs are still fully supported, look basically identical,
304+
and work on older versions of Rails.
305+
306+
On the other hand, feature specs require non-trivial configuration
307+
to get some important features working,
308+
like JavaScript testing or making sure each test runs with a fresh DB state.
309+
With system specs, this configuration is provided out-of-the-box.
299310

300-
If you don’t have the luxury of upgrading,
301-
there’s no problem with using feature specs instead.
302-
Be sure to add [Capybara][] to the `:test` group of your `Gemfile` first:
311+
Like system specs, feature specs require the [Capybara][] gem.
312+
Rails 5.1+ includes it by default as part of system tests,
313+
but if you don’t have the luxury of upgrading,
314+
be sure to add it to the `:test` group of your `Gemfile` first:
303315

304316
```ruby
305317
group :test do
306318
gem "capybara"
307319
end
308320
```
309321

310-
(It’s actually required for both feature and system specs,
311-
but Rails includes it by default in versions 5.1+.)
312-
313322
[officially recommends system specs]: http://rspec.info/blog/2017/10/rspec-3-7-has-been-released/#rails-actiondispatchsystemtest-integration-system-specs
314323
[Capybara]: https://github.com/teamcapybara/capybara
315324

0 commit comments

Comments
 (0)