rails-controller-testing
コントローラーのテストでassignsなどを使うときはgemを入れる必要がある
下記のようなエラー
code: (sh)
Failure/Error: expect(assigns(:user)).to be_a_new(User)
NoMethodError:
assigns has been extracted to a gem. To continue using it,
add gem 'rails-controller-testing' to your Gemfile.
Gemfileに追記
`gem 'rails-controller-testing', require: false`
spec/rails_helperに追記
code: (ruby)
RSpec.configure do |config|
require 'rails-controller-testing'
config.include ::Rails::Controller::Testing::TestProcess, type: type
config.include ::Rails::Controller::Testing::TemplateAssertions, type: type
config.include ::Rails::Controller::Testing::Integration, type: type
end
end