diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-23 12:08:38 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-23 12:08:38 +0000 |
commit | 5ad0cf26551baff8f08af8562a8d45e6ec14d71a (patch) | |
tree | 57f1a6bad31bcd11efacd3fdfb9cc92f88fb6a86 /spec/support/shared_contexts/features/error_tracking_shared_context.rb | |
parent | f47c768fad17d4c876e96524f83f8306f071db66 (diff) | |
download | gitlab-ce-5ad0cf26551baff8f08af8562a8d45e6ec14d71a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_contexts/features/error_tracking_shared_context.rb')
-rw-r--r-- | spec/support/shared_contexts/features/error_tracking_shared_context.rb | 27 |
1 files changed, 27 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..3da6e2b13bb --- /dev/null +++ b/spec/support/shared_contexts/features/error_tracking_shared_context.rb @@ -0,0 +1,27 @@ +# 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 + request_headers = { 'Authorization' => 'Bearer access_token_123', 'Content-Type' => 'application/json' } + response_headers = { 'Content-Type' => 'application/json' } + issue_url = sentry_api_urls.issue_url(issue_id).to_s + stub_request(:get, issue_url) + .with(headers: request_headers) + .to_return(status: 200, body: issue_response_body, headers: response_headers) + event_url = sentry_api_urls.issue_latest_event_url(issue_id).to_s + stub_request(:get, event_url) + .with(headers: request_headers) + .to_return(status: 200, body: event_response_body, headers: response_headers) + end +end |