Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-10 21:07:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-10 21:07:43 +0300
commit6f0f893bd87535b61e0ecb1ce069eaa7fcb9e5be (patch)
tree8af92b29c838e9af2fd70f9a4a2314a08f4af922 /spec/models/error_tracking
parent8b1228b0d409d7751f01d9fb72ebfbbf62399486 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/error_tracking')
-rw-r--r--spec/models/error_tracking/project_error_tracking_setting_spec.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/models/error_tracking/project_error_tracking_setting_spec.rb b/spec/models/error_tracking/project_error_tracking_setting_spec.rb
index 03e4c04f97e..3dfdd9c1392 100644
--- a/spec/models/error_tracking/project_error_tracking_setting_spec.rb
+++ b/spec/models/error_tracking/project_error_tracking_setting_spec.rb
@@ -210,6 +210,53 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
end
end
+ describe '#issue_details' do
+ let(:issue) { build(:detailed_error_tracking_error) }
+ let(:sentry_client) { double('sentry_client', issue_details: issue) }
+ let(:commit_id) { '123456' }
+
+ let(:result) do
+ subject.issue_details
+ end
+
+ context 'when cached' do
+ before do
+ stub_reactive_cache(subject, issue, {})
+ synchronous_reactive_cache(subject)
+
+ expect(subject).to receive(:sentry_client).and_return(sentry_client)
+ end
+
+ it { expect(result).to eq(issue: issue) }
+ it { expect(result[:issue].first_release_version).to eq(commit_id) }
+ it { expect(result[:issue].gitlab_commit).to eq(nil) }
+
+ context 'when release version is nil' do
+ before do
+ issue.first_release_version = nil
+ end
+
+ it { expect(result[:issue].gitlab_commit).to eq(nil) }
+ end
+
+ context 'when repo commit matches first relase version' do
+ let(:commit) { double('commit', id: commit_id) }
+ let(:repository) { double('repository', commit: commit) }
+
+ before do
+ expect(project).to receive(:repository).and_return(repository)
+ end
+
+ it { expect(result[:issue].gitlab_commit).to eq(commit_id) }
+ end
+ end
+
+ context 'when not cached' do
+ it { expect(subject).not_to receive(:sentry_client) }
+ it { expect(result).to be_nil }
+ end
+ end
+
describe '#update_issue' do
let(:opts) do
{ status: 'resolved' }