I was updating a Rails 6 project, there were som technical debt, I needed to remove or make failing tests pass. When I was trying to fix request spect, I found out that sign_in and sign_up devise helpers did not work.

Even after reading Devise documentation I could not make it work. It turns out that we need IntegrationHelpers to be added for request. So in spec/rails_helper.rb, add the following lines after require 'rspec/rails:

RSpec.configure do |config|
  config.include Devise::Test::ControllerHelpers, type: :controller
  config.include Devise::Test::ControllerHelpers, type: :view
  config.include Devise::Test::IntegrationHelpers, type: :feature
  config.include Devise::Test::IntegrationHelpers, type: :request
end

and it should work fine.

The main thing you must note is this line:

config.include Devise::Test::IntegrationHelpers, type: :request

where we make IntegrationHelpers available in request spec.

Happy Coding!