summaryrefslogtreecommitdiff
path: root/spec/features/issuables/close_reopen_report_toggle_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/issuables/close_reopen_report_toggle_spec.rb')
-rw-r--r--spec/features/issuables/close_reopen_report_toggle_spec.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/features/issuables/close_reopen_report_toggle_spec.rb b/spec/features/issuables/close_reopen_report_toggle_spec.rb
index de6f5fe1560..26c44baeb21 100644
--- a/spec/features/issuables/close_reopen_report_toggle_spec.rb
+++ b/spec/features/issuables/close_reopen_report_toggle_spec.rb
@@ -56,6 +56,24 @@ describe 'Issuables Close/Reopen/Report toggle' do
end
it_behaves_like 'an issuable close/reopen/report toggle'
+
+ context 'when the issue is closed and locked' do
+ let(:issuable) { create(:issue, :closed, :locked, project: project) }
+
+ it 'hides the reopen button' do
+ expect(page).not_to have_link('Reopen issue')
+ end
+
+ context 'when the issue author is the current user' do
+ before do
+ issuable.update(author: user)
+ end
+
+ it 'hides the reopen button' do
+ expect(page).not_to have_link('Reopen issue')
+ end
+ end
+ end
end
context 'when user doesnt have permission to update' do
@@ -93,6 +111,28 @@ describe 'Issuables Close/Reopen/Report toggle' do
end
it_behaves_like 'an issuable close/reopen/report toggle'
+
+ context 'when the merge request is merged' do
+ let(:issuable) { create(:merge_request, :merged, source_project: project) }
+
+ it 'shows only the `Report abuse` and `Edit` button' do
+ expect(page).to have_link('Report abuse')
+ expect(page).to have_link('Edit')
+ expect(page).not_to have_link('Close merge request')
+ expect(page).not_to have_link('Reopen merge request')
+ end
+
+ context 'when the merge request author is the current user' do
+ let(:issuable) { create(:merge_request, :merged, source_project: project, author: user) }
+
+ it 'shows only the `Edit` button' do
+ expect(page).to have_link('Edit')
+ expect(page).not_to have_link('Report abuse')
+ expect(page).not_to have_link('Close merge request')
+ expect(page).not_to have_link('Reopen merge request')
+ end
+ end
+ end
end
context 'when user doesnt have permission to update' do