title: What is the best way to test application controller rescue status codes in Rails 5?
body: <p>I am running into an interesting challenge this weekend.  I want to test the following 4 rescue statements.  What do you feel is the best approach? I have been testing anonymous controllers, gets, and more but I am coming up blank. Is this even possible? </p>
  
  <p><strong>Rspec</strong></p>
  
  <pre><code># frozen_string_literal: true
  
  require 'rails_helper'
  
  RSpec.describe ApplicationController, type: :controller do
    it 'rescue record not found with 404' do
  
    end
  
    it 'rescue parameter missing with 400' do
  
    end
  
    it 'rescue routing error with 400' do
  
    end
  
    it 'rescue invalid authenticity token with 400' do
  
    end
  end
  </code></pre>
  
  <p><strong>Application Controller</strong></p>
  
  <pre><code># frozen_string_literal: true
  
  class ApplicationController &lt; ActionController::Base
    force_ssl if: :ssl_configured?
  
    rescue_from ActiveRecord::RecordNotFound, with: :render_404
    rescue_from ActionController::ParameterMissing, with: :render_400
    rescue_from ActionController::RoutingError, with: :render_404
    rescue_from ActionController::InvalidAuthenticityToken, with: :render_400
  
    include StatusCodes
    include JsonTester
  
    private
  
    def ssl_configured?
      AppUnsecure.settings[:ssl_configured]
    end
  end
  </code></pre>