I'm using rails 7.
I've just installed rspec-rails
in this way:
# Gemfile
group :test do
gem "rspec-rails"
end
And I generated a controller.
$ rails g controller welcome home
create app/controllers/welcome_controller.rb
route get 'welcome/home'
invoke erb
create app/views/welcome
create app/views/welcome/home.html.erb
invoke test_unit
create test/controllers/welcome_controller_test.rb
invoke helper
create app/helpers/welcome_helper.rb
invoke test_unit
But I found out that rails generated minitests instead of specs.
Why is this? What should I do to fix this out?
CodePudding user response:
It is necessary to add rspec-rails
to :development
group in order to get generators working.
# Gemfile
group :test, :development do
gem "rspec-rails"
end
I found this out here