I'm looking for a comprehensive list of RSpec's generators to easily generate specs for controllers, models, helpers, and so on. The only one I've found is:
rails g integration_test name
that saves a spec inside the spec/requests folder.
example usage:
rails g rspec:integration events
--> create spec/requests/events_spec.rb
All the rspec-rails generators can be found at https://github.com/rspec/rspec-rails/tree/master/lib/generators/rspec You'll have to dig around in the code a little to see what they do, but they are well organized so it shouldn't be too much of a pain.
There's also a short readme on the generators which basically says that they are run automatically when you run one of the standard Rails generators (rails g model User):
If you type script/rails generate, the only RSpec generator you'll actually see is rspec:install. That's because RSpec is registered with Rails as the test framework, so whenever you generate application components like models, controllers, etc, RSpec specs are generated instead of Test::Unit tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With