blob: 7c577cbf11ca240b636fe3b71b96130e3a1dfd8b (
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
|
# frozen_string_literal: true
require "spec_helper"
RSpec.describe ArtifactsHelper, feature_category: :build_artifacts do
let_it_be(:user) { build_stubbed(:user) }
let_it_be(:project) { build_stubbed(:project) }
describe '#artifacts_app_data' do
before do
allow(helper).to receive(:current_user) { user }
allow(helper).to receive(:can?).with(user, :destroy_artifacts, project).and_return(false)
end
subject { helper.artifacts_app_data(project) }
it 'returns expected data' do
expect(subject).to include({
project_path: project.full_path,
project_id: project.id,
artifacts_management_feedback_image_path: match_asset_path('illustrations/chat-bubble-sm.svg')
})
end
describe 'can_destroy_artifacts' do
it 'returns false without permission' do
expect(subject[:can_destroy_artifacts]).to eq('false')
end
it 'returns true when user has permission' do
allow(helper).to receive(:can?).with(user, :destroy_artifacts, project).and_return(true)
expect(subject[:can_destroy_artifacts]).to eq('true')
end
end
end
end
|