Commit 21e11de3 authored by Markus Koller's avatar Markus Koller

Merge branch 'sy-add-safe-nav-test' into 'master'

Exercise safe navigator in test for StatusPage::MarkForPublication

Closes #217663

See merge request gitlab-org/gitlab!33996
parents ca38661a 8409f860
......@@ -21,7 +21,12 @@ RSpec.describe StatusPage::MarkForPublicationService do
shared_examples 'does not track the incident' do
specify { expect { subject }.not_to change { ::StatusPage::PublishedIncident.count } }
specify { expect { subject }.not_to change { issue.notes.count } }
specify { expect(subject).to be_error }
it 'returns the exepected error state' do
expect(Gitlab::ErrorTracking).not_to receive(:track_exception)
expect(subject).to be_error
end
end
context 'when license is not available' do
......@@ -63,6 +68,12 @@ RSpec.describe StatusPage::MarkForPublicationService do
it_behaves_like 'does not track the incident'
end
context 'when user is not logged in' do
let(:service) { described_class.new(project, nil, issue) }
it_behaves_like 'does not track the incident'
end
context 'when user does not have permissions' do
let(:service) { described_class.new(project, create(:user), issue) }
......@@ -76,12 +87,13 @@ RSpec.describe StatusPage::MarkForPublicationService do
allow(::SystemNoteService).to receive(:publish_issue_to_status_page).and_raise(error)
end
it_behaves_like 'does not track the incident'
specify { expect { subject }.not_to change { ::StatusPage::PublishedIncident.count } }
specify { expect { subject }.not_to change { issue.notes.count } }
it 'reports the error to sentry' do
it 'returns the exepected error state and reports the error to sentry' do
expect(Gitlab::ErrorTracking).to receive(:track_exception).with(error)
subject
expect(subject).to be_error
end
end
end
......
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