In my application_controller.rb I have a line
# Get the previous url string nicely.
previousPath = Rails.application.routes.recognize_path(request.referrer)
But I get this error on that line
NoMethodError (undefined method `authenticate?' for nil:NilClass)
Which seems like something to do with devise. But when I do include Devise::TestHelpers, I get env is not defined or something, which doesn't seem like a good solution in any way possible.
Any ideas on how to solve this without needing me to catch errors or regexp to split the path?