diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/controllers/graphql_controller_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/controllers/graphql_controller_spec.rb')
-rw-r--r-- | spec/controllers/graphql_controller_spec.rb | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb index 4de31e2e135..0818dce776d 100644 --- a/spec/controllers/graphql_controller_spec.rb +++ b/spec/controllers/graphql_controller_spec.rb @@ -9,15 +9,10 @@ RSpec.describe GraphqlController do stub_feature_flags(graphql: true) end - describe 'ArgumentError' do - let(:user) { create(:user) } - let(:message) { 'green ideas sleep furiously' } + describe 'rescue_from' do + let_it_be(:message) { 'green ideas sleep furiously' } - before do - sign_in(user) - end - - it 'handles argument errors' do + it 'handles ArgumentError' do allow(subject).to receive(:execute) do raise Gitlab::Graphql::Errors::ArgumentError, message end @@ -28,6 +23,19 @@ RSpec.describe GraphqlController do 'errors' => include(a_hash_including('message' => message)) ) end + + it 'handles StandardError' do + allow(subject).to receive(:execute) do + raise StandardError, message + end + + post :execute + + expect(json_response).to include( + 'errors' => include(a_hash_including('message' => /Internal server error/, + 'raisedAt' => /graphql_controller_spec.rb/)) + ) + end end describe 'POST #execute' do |