diff options
Diffstat (limited to 'spec/graphql/resolvers/projects')
-rw-r--r-- | spec/graphql/resolvers/projects/jira_projects_resolver_spec.rb | 13 | ||||
-rw-r--r-- | spec/graphql/resolvers/projects/snippets_resolver_spec.rb | 6 |
2 files changed, 12 insertions, 7 deletions
diff --git a/spec/graphql/resolvers/projects/jira_projects_resolver_spec.rb b/spec/graphql/resolvers/projects/jira_projects_resolver_spec.rb index c6d8c518fb7..b95bab41e3e 100644 --- a/spec/graphql/resolvers/projects/jira_projects_resolver_spec.rb +++ b/spec/graphql/resolvers/projects/jira_projects_resolver_spec.rb @@ -14,10 +14,10 @@ RSpec.describe Resolvers::Projects::JiraProjectsResolver do let_it_be(:project) { create(:project) } shared_examples 'no project service access' do - it 'raises error' do - expect do + it 'generates an error' do + expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::ResourceNotAvailable) do resolve_jira_projects - end.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) + end end end @@ -89,11 +89,14 @@ RSpec.describe Resolvers::Projects::JiraProjectsResolver do .to_raise(JIRA::HTTPError.new(double(message: '{"errorMessages":["Some failure"]}'))) end - it 'raises failure error' do + it 'generates a failure error' do config_docs_link_url = Rails.application.routes.url_helpers.help_page_path('integration/jira/configure') docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: config_docs_link_url } error_message = 'An error occurred while requesting data from Jira: Some failure. Check your %{docs_link_start}Jira integration configuration</a> and try again.' % { docs_link_start: docs_link_start } - expect { resolve_jira_projects }.to raise_error(error_message) + + expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::BaseError, error_message) do + resolve_jira_projects + end end end end diff --git a/spec/graphql/resolvers/projects/snippets_resolver_spec.rb b/spec/graphql/resolvers/projects/snippets_resolver_spec.rb index 2d8929c0e8f..b963f2509db 100644 --- a/spec/graphql/resolvers/projects/snippets_resolver_spec.rb +++ b/spec/graphql/resolvers/projects/snippets_resolver_spec.rb @@ -81,12 +81,14 @@ RSpec.describe Resolvers::Projects::SnippetsResolver do end context 'when project snippets are disabled' do - it 'raises an error' do + it 'generates an error' do disabled_snippet_project = create(:project, :snippets_disabled) disabled_snippet_project.add_developer(current_user) expect(SnippetsFinder).not_to receive(:new) - expect { resolve_snippets(obj: disabled_snippet_project) }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) + expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::ResourceNotAvailable) do + resolve_snippets(obj: disabled_snippet_project) + end end end end |