diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 15:08:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 15:08:40 +0300 |
commit | be3e24ea3c9f497efde85900df298ce9bc42fce8 (patch) | |
tree | fd0de9443253a1b21ca9a2741dc34ba3aef795be /spec/support/shared_contexts | |
parent | 001243986195143c395a9811d8254bbf1b9ebfa1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_contexts')
-rw-r--r-- | spec/support/shared_contexts/features/error_tracking_shared_context.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/support/shared_contexts/features/error_tracking_shared_context.rb b/spec/support/shared_contexts/features/error_tracking_shared_context.rb new file mode 100644 index 00000000000..230554ce7ac --- /dev/null +++ b/spec/support/shared_contexts/features/error_tracking_shared_context.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +shared_context 'sentry error tracking context feature' do + include ReactiveCachingHelpers + + let_it_be(:project) { create(:project) } + let_it_be(:project_error_tracking_settings) { create(:project_error_tracking_setting, project: project) } + let_it_be(:issue_response_body) { fixture_file('sentry/issue_sample_response.json') } + let_it_be(:issue_response) { JSON.parse(issue_response_body) } + let_it_be(:event_response_body) { fixture_file('sentry/issue_latest_event_sample_response.json') } + let_it_be(:event_response) { JSON.parse(event_response_body) } + let(:sentry_api_urls) { Sentry::ApiUrls.new(project_error_tracking_settings.api_url) } + let(:issue_id) { issue_response['id'] } + + before do + stub_request(:get, sentry_api_urls.issue_url(issue_id)).with( + headers: { 'Authorization' => 'Bearer access_token_123' } + ).to_return(status: 200, body: issue_response_body, headers: { 'Content-Type' => 'application/json' }) + stub_request(:get, sentry_api_urls.issue_latest_event_url(issue_id)).with( + headers: { 'Authorization' => 'Bearer access_token_123' } + ).to_return(status: 200, body: event_response_body, headers: { 'Content-Type' => 'application/json' }) + end +end |