blob: 5535eb8c2144836510fe9a75d0432164056c08fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
|