If you are new to this. First read this article about Anonymous Controller. That should answer 98% of your questions. However, if you run in to problems the following tid bits of information might help ;)
Summary of Anonymous Controller (code stolen from https://www.relishapp.com/rspec/rspec-rails/v/3-0/docs/controller-specs/anonymous-controller)
class ApplicationController < ActionController::Base class AccessDenied < StandardError; end rescue_from AccessDenied, :with => :access_deniedprivate def access_denied redirect_to "/401.html" end end require "rails_helper" RSpec.describe ApplicationController do controller do def index raise ApplicationController::AccessDenied end end describe "handling AccessDenied exceptions" do it "redirects to the /401.html page" do get :index expect(response).to redirect_to("/401.html") end end end Gotchas Missing helper methods If RSpec is having problems finding your helper methods within the Anonymous controller (it shouldn’t, because by default the controller should inherit from the controller you are testing), try the following.
...