diff options
Diffstat (limited to 'spec/controllers/graphql_controller_spec.rb')
-rw-r--r-- | spec/controllers/graphql_controller_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb index f9b15c9a48e..578ce04721c 100644 --- a/spec/controllers/graphql_controller_spec.rb +++ b/spec/controllers/graphql_controller_spec.rb @@ -262,5 +262,16 @@ RSpec.describe GraphqlController do expect(controller).to have_received(:append_info_to_payload) expect(log_payload.dig(:metadata, :graphql)).to match_array(expected_logs) end + + it 'appends the exception in case of errors' do + exception = StandardError.new('boom') + + expect(controller).to receive(:execute).and_raise(exception) + + post :execute, params: { _json: graphql_queries } + + expect(controller).to have_received(:append_info_to_payload) + expect(log_payload.dig(:exception_object)).to eq(exception) + end end end |