diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-10 20:49:26 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-11 11:51:43 +0300 |
commit | c39e3f22ce12a302e294deb3523414e4a684b6fb (patch) | |
tree | 2a0e8d4bb5c2b81ef6c8bb82758f05c52b8642fc /spec/features | |
parent | 04c7d0d55500e6f118bd17153f3af11e83fce826 (diff) |
Show `New Issue` link for projects
When a user is not logged in, we want to show the `New Issue` link so
he gets directed to the login flow first.
When a project is archived, we never want to show the link.
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/commit/cherry_pick_spec.rb | 10 | ||||
-rw-r--r-- | spec/features/projects/commit/user_reverts_commit_spec.rb | 17 | ||||
-rw-r--r-- | spec/features/projects/issues/user_views_issue_spec.rb | 18 |
3 files changed, 44 insertions, 1 deletions
diff --git a/spec/features/projects/commit/cherry_pick_spec.rb b/spec/features/projects/commit/cherry_pick_spec.rb index c4c399e3058..2f9d4f67488 100644 --- a/spec/features/projects/commit/cherry_pick_spec.rb +++ b/spec/features/projects/commit/cherry_pick_spec.rb @@ -89,4 +89,14 @@ describe 'Cherry-pick Commits' do expect(page).to have_content('The commit has been successfully cherry-picked.') end end + + context 'when the project is archived' do + let(:project) { create(:project, :repository, namespace: group, archived: true) } + + it 'does not show the cherry-pick link' do + find('.header-action-buttons a.dropdown-toggle').click + + expect(page).not_to have_css("a[href='#modal-cherry-pick-commit']") + end + end end diff --git a/spec/features/projects/commit/user_reverts_commit_spec.rb b/spec/features/projects/commit/user_reverts_commit_spec.rb index 221f1d7757e..5a09e2380b6 100644 --- a/spec/features/projects/commit/user_reverts_commit_spec.rb +++ b/spec/features/projects/commit/user_reverts_commit_spec.rb @@ -10,13 +10,16 @@ describe 'User reverts a commit', :js do sign_in(user) visit(project_commit_path(project, sample_commit.id)) + end + def click_revert find('.header-action-buttons .dropdown').click find('a[href="#modal-revert-commit"]').click end context 'without creating a new merge request' do before do + click_revert page.within('#modal-revert-commit') do uncheck('create_merge_request') click_button('Revert') @@ -44,6 +47,10 @@ describe 'User reverts a commit', :js do end context 'with creating a new merge request' do + before do + click_revert + end + it 'reverts a commit' do page.within('#modal-revert-commit') do click_button('Revert') @@ -53,4 +60,14 @@ describe 'User reverts a commit', :js do expect(page).to have_content("From revert-#{Commit.truncate_sha(sample_commit.id)} into master") end end + + context 'when the project is archived' do + let(:project) { create(:project, :repository, namespace: user.namespace, archived: true) } + + it 'does not show the revert link' do + find('.header-action-buttons .dropdown').click + + expect(page).not_to have_link('Revert') + end + end end diff --git a/spec/features/projects/issues/user_views_issue_spec.rb b/spec/features/projects/issues/user_views_issue_spec.rb index f7f2cde3d64..d17ce636f3b 100644 --- a/spec/features/projects/issues/user_views_issue_spec.rb +++ b/spec/features/projects/issues/user_views_issue_spec.rb @@ -6,11 +6,27 @@ describe "User views issue" do set(:issue) { create(:issue, project: project, description: "# Description header", author: user) } before do - project.add_guest(user) + project.add_developer(user) sign_in(user) visit(project_issue_path(project, issue)) end it { expect(page).to have_header_with_correct_id_and_link(1, "Description header", "description-header") } + + it { expect(page).to have_link('New issue') } + + it { expect(page).to have_button('Create merge request') } + + it { expect(page).to have_link('Close issue') } + + context 'when the project is archived' do + let(:project) { create(:project, :public, archived: true) } + + it { expect(page).not_to have_link('New issue') } + + it { expect(page).not_to have_button('Create merge request') } + + it { expect(page).not_to have_link('Close issue') } + end end |