diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-01-09 10:18:47 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-01-09 10:18:47 +0100 |
commit | fa8052a47b713999220c8377059462a869884da8 (patch) | |
tree | 93561610b19e0bf83400b74708aa80c50a056d42 /spec/features | |
parent | 8ab94120ee0a87c7b1158ebafea101e3952ec758 (diff) | |
download | gitlab-ce-fa8052a47b713999220c8377059462a869884da8.tar.gz |
Do not show artifacts keep button if not allowed
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/builds_spec.rb | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/spec/features/projects/builds_spec.rb b/spec/features/projects/builds_spec.rb index 8c4d4320dc5..984918e22f7 100644 --- a/spec/features/projects/builds_spec.rb +++ b/spec/features/projects/builds_spec.rb @@ -3,6 +3,7 @@ require 'tempfile' feature 'Builds', :feature do let(:user) { create(:user) } + let(:user_access_level) { :developer } let(:project) { create(:project) } let(:pipeline) { create(:ci_pipeline, project: project) } @@ -14,7 +15,7 @@ feature 'Builds', :feature do end before do - project.team << [user, :developer] + project.team << [user, user_access_level] login_as(user) end @@ -131,7 +132,9 @@ feature 'Builds', :feature do context 'Artifacts expire date' do before do - build.update_attributes(artifacts_file: artifacts_file, artifacts_expire_at: expire_at) + build.update_attributes(artifacts_file: artifacts_file, + artifacts_expire_at: expire_at) + visit namespace_project_build_path(project.namespace, project, build) end @@ -146,12 +149,23 @@ feature 'Builds', :feature do context 'when expire date is defined' do let(:expire_at) { Time.now + 7.days } - it 'keeps artifacts when Keep button is clicked' do - expect(page).to have_content 'The artifacts will be removed' - click_link 'Keep' + context 'when user has ability to update build' do + it 'keeps artifacts when keep button is clicked' do + expect(page).to have_content 'The artifacts will be removed' - expect(page).not_to have_link 'Keep' - expect(page).not_to have_content 'The artifacts will be removed' + click_link 'Keep' + + expect(page).not_to have_link 'Keep' + expect(page).not_to have_content 'The artifacts will be removed' + end + end + + context 'when user does not have ability to update build' do + let(:user_access_level) { :guest } + + it 'does not have keep button' do + expect(page).to have_no_link 'Keep' + end end end |