Commit 688c0414 authored by charlie ablett's avatar charlie ablett

Add GraphQL error for test/dev

Update some tests to match loosely instead of exactly
parent 07274bf4
......@@ -37,8 +37,12 @@ class GraphqlController < ApplicationController
rescue_from StandardError do |exception|
log_exception(exception)
if Rails.env.test? || Rails.env.development?
render_error("Internal server error: #{exception.message}")
else
render_error("Internal server error")
end
end
rescue_from Gitlab::Graphql::Variables::Invalid do |exception|
render_error(exception.message, status: :unprocessable_entity)
......
......@@ -32,7 +32,9 @@ RSpec.describe 'Creating a DAST Site Profile' do
allow(DastSiteProfile).to receive(:create!).and_raise(StandardError)
end
it_behaves_like 'a mutation that returns top-level errors', errors: ['Internal server error']
it_behaves_like 'a mutation that returns top-level errors' do
let(:match_errors) { contain_exactly(include('Internal server error')) }
end
end
end
end
......@@ -38,7 +38,9 @@ RSpec.describe 'Creating a DAST Site Profile' do
dast_site_profile.destroy!
end
it_behaves_like 'a mutation that returns top-level errors', errors: ['Internal server error']
it_behaves_like 'a mutation that returns top-level errors' do
let(:match_errors) { contain_exactly(include("Internal server error: Couldn't find DastSiteProfile")) }
end
end
context 'when wrong type of global id is passed' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment