summaryrefslogtreecommitdiff
path: root/spec/features/projects/files/user_edits_files_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/files/user_edits_files_spec.rb')
-rw-r--r--spec/features/projects/files/user_edits_files_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/features/projects/files/user_edits_files_spec.rb b/spec/features/projects/files/user_edits_files_spec.rb
index 523a9f3f4fe..ee9deb30890 100644
--- a/spec/features/projects/files/user_edits_files_spec.rb
+++ b/spec/features/projects/files/user_edits_files_spec.rb
@@ -12,6 +12,27 @@ describe 'Projects > Files > User edits files' do
sign_in(user)
end
+ shared_examples 'unavailable for an archived project' do
+ it 'does not show the edit link for an archived project', :js do
+ project.update!(archived: true)
+ visit project_tree_path(project, project.repository.root_ref)
+
+ click_link('.gitignore')
+
+ aggregate_failures 'available edit buttons' do
+ # We're showing a link, if the user can edit directly, this is becomes a
+ # button when the user can fork the project.
+ expect(page).not_to have_link('Edit')
+ expect(page).not_to have_button('Edit')
+ expect(page).not_to have_link('Web IDE')
+ expect(page).not_to have_button('Web IDE')
+
+ expect(page).not_to have_button('Replace')
+ expect(page).not_to have_button('Delete')
+ end
+ end
+ end
+
context 'when an user has write access' do
before do
project.add_master(user)
@@ -85,6 +106,8 @@ describe 'Projects > Files > User edits files' do
expect(page).to have_css('.line_holder.new')
end
+
+ it_behaves_like 'unavailable for an archived project'
end
context 'when an user does not have write access' do
@@ -168,6 +191,10 @@ describe 'Projects > Files > User edits files' do
expect(page).to have_content("From #{forked_project.full_path}")
expect(page).to have_content("into #{project2.full_path}")
end
+
+ it_behaves_like 'unavailable for an archived project' do
+ let(:project) { project2 }
+ end
end
end
end