DEV: Raise special check_xhr exception in tests (PR #9992)

Solves a papercut in tests when you forget .json on an endpoint by raising a special exception.


Instead of doing this check at runtime, we can defined the error as a constant so that the check is only done.

Do you mean switching out the method body based on Rails.env.test?

I was thinking something like

ERROR_CLASS = Rails.env.test? ? ApplicationController::CheckXhrForTest : ApplicationController::RenderEmpty

def check_xhr

Still failing a few tests that are dependent on the old behavior.