Commit 09a03bae authored by Quang-Minh Nguyen's avatar Quang-Minh Nguyen

Refactor ErrorTracking test

parent 35dd5bb3
......@@ -8,16 +8,18 @@ RSpec.describe Gitlab::ErrorTracking do
let(:exception) { RuntimeError.new('boom') }
let(:issue_url) { 'http://gitlab.com/gitlab-org/gitlab-foss/issues/1' }
let(:user) { create(:user) }
let(:sentry_payload) do
{
tags: {
program: 'test',
locale: 'en',
feature_category: nil,
feature_category: 'feature_a',
correlation_id: 'cid'
},
user: {
username: nil
username: user.username
},
extra: {
some_other_info: 'info',
......@@ -32,9 +34,9 @@ RSpec.describe Gitlab::ErrorTracking do
'exception.message' => 'boom',
'tags.program' => 'test',
'tags.locale' => 'en',
'tags.feature_category' => nil,
'tags.feature_category' => 'feature_a',
'tags.correlation_id' => 'cid',
'user.username' => nil,
'user.username' => user.username,
'extra.some_other_info' => 'info',
'extra.issue_url' => 'http://gitlab.com/gitlab-org/gitlab-foss/issues/1'
}
......@@ -52,6 +54,12 @@ RSpec.describe Gitlab::ErrorTracking do
end
end
around do |example|
Gitlab::ApplicationContext.with_context(user: user, feature_category: 'feature_a') do
example.run
end
end
describe '.track_and_raise_for_dev_exception' do
context 'when exceptions for dev should be raised' do
before do
......
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