File: Generators.md

package info (click to toggle)
ruby-rspec-rails 7.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,796 kB
  • sloc: ruby: 11,068; sh: 198; makefile: 6
file content (33 lines) | stat: -rw-r--r-- 755 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Using generators

RSpec `_spec.rb` files are normally generated alongside other application components.
For instance, `rails generate model` will also generate an RSpec `_spec.rb` file
for the model.

Note that the generators are there to help you get started, but they are no
substitute for writing your own examples, and they are only guaranteed to work
out of the box for with Rails' defaults.

RSpec generators can also be run independently. For instance,

```console
rails generate rspec:model widget
```

will create a new spec file in `spec/models/widget_spec.rb`.

The same generator pattern is available for all specs:

* channel
* controller
* feature
* generator
* helper
* job
* mailbox
* mailer
* model
* request
* scaffold
* system
* view