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-17 00:08:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-17 00:08:24 +0300
commit727b1a890c8e44440414c59611e9ead34d6edc93 (patch)
treede5f272452d2ee4d3e2edb90936fe7ecca127431 /spec/finders
parentaa0f0e992153e84e1cdec8a1c7310d5eb93a9f8f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/sentry_issue_finder_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/finders/sentry_issue_finder_spec.rb b/spec/finders/sentry_issue_finder_spec.rb
new file mode 100644
index 00000000000..5535eb8c214
--- /dev/null
+++ b/spec/finders/sentry_issue_finder_spec.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe SentryIssueFinder do
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :repository) }
+ let(:issue) { create(:issue, project: project) }
+ let(:sentry_issue) { create(:sentry_issue, issue: issue) }
+
+ let(:finder) { described_class.new(project, current_user: user) }
+
+ describe '#execute' do
+ let(:identifier) { sentry_issue.sentry_issue_identifier }
+
+ subject { finder.execute(identifier) }
+
+ context 'when the user is not part of the project' do
+ it { is_expected.to be_nil }
+ end
+
+ context 'when the user is a project developer' do
+ before do
+ project.add_developer(user)
+ end
+
+ it { is_expected.to eq(sentry_issue) }
+
+ context 'when identifier is incorrect' do
+ let(:identifier) { 1234 }
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'when accessing another projects identifier' do
+ let(:second_project) { create(:project) }
+ let(:second_issue) { create(:issue, project: second_project) }
+ let(:second_sentry_issue) { create(:sentry_issue, issue: second_issue) }
+
+ let(:identifier) { second_sentry_issue.sentry_issue_identifier }
+
+ it { is_expected.to be_nil }
+ end
+ end
+ end
+end