Module: Graphiti::Rails::TestHelpers

Includes:
RescueRegistry::RailsTestHelpers
Included in:
RakeHelpers
Defined in:
lib/graphiti/rails/test_helpers.rb

Overview

Wrap a request in handle_request_exceptions to assert on the rendered error payload. Exceptions propagate untouched in tests otherwise.

Instance Method Summary collapse

Instance Method Details

#handle_request_exceptions(handle = true, &block) ⇒ Object

rescue_registry sets action_dispatch.show_exceptions to true/false. Rails 7.1 replaced those with :all/:rescuable/:none, and Rails 8 dropped boolean handling altogether. ExceptionWrapper#show? now treats everything that is not :none as "show", so passing false would leave exception handling on and silently do nothing.



13
14
15
# File 'lib/graphiti/rails/test_helpers.rb', line 13

def handle_request_exceptions(handle = true, &block)
  super(handle ? :all : :none, &block)
end

#handle_request_exceptions?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/graphiti/rails/test_helpers.rb', line 17

def handle_request_exceptions?
  ::Rails.application.config.action_dispatch.show_exceptions != :none
end