diff options
author | Felipe Artur <fcardozo@gitlab.com> | 2019-09-04 16:33:02 +0000 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2019-09-04 16:33:02 +0000 |
commit | 13fc0efa5725d94cda527dc487d8dfdb7e90ed21 (patch) | |
tree | e059e8ad1ffece44218974140ec04cdfe8de5a07 /spec/policies | |
parent | 24de5d65733de22fd067f150e65e36eb6121d17f (diff) | |
download | gitlab-ce-13fc0efa5725d94cda527dc487d8dfdb7e90ed21.tar.gz |
Let project reporters create issue from group boards
The current state of group issue boards does not show the "Add issues"
button on the UI for users that are reporters of group child projects.
Diffstat (limited to 'spec/policies')
-rw-r--r-- | spec/policies/board_policy_spec.rb | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/spec/policies/board_policy_spec.rb b/spec/policies/board_policy_spec.rb index 52c23951e37..35eac8a02c4 100644 --- a/spec/policies/board_policy_spec.rb +++ b/spec/policies/board_policy_spec.rb @@ -56,4 +56,57 @@ describe BoardPolicy do end end end + + context 'create_non_backlog_issues' do + context 'for project boards' do + let!(:current_user) { create(:user) } + + subject { described_class.new(current_user, project_board) } + + context 'when user can admin project issues' do + it 'allows to add non backlog issues from issue board' do + project.add_reporter(current_user) + + expect_allowed(:create_non_backlog_issues) + end + end + + context 'when user cannot admin project issues' do + it 'does not allow to add non backlog issues from issue board' do + project.add_guest(current_user) + + expect_disallowed(:create_non_backlog_issues) + end + end + end + + context 'for group boards' do + let!(:current_user) { create(:user) } + let!(:project_1) { create(:project, namespace: group) } + let!(:project_2) { create(:project, namespace: group) } + let!(:group_board) { create(:board, group: group) } + + subject { described_class.new(current_user, group_board) } + + before do + project_1.add_guest(current_user) + end + + context 'when user is at least reporter in one of the child projects' do + it 'allows to add non backlog issues from issue board' do + project_2.add_reporter(current_user) + + expect_allowed(:create_non_backlog_issues) + end + end + + context 'when user is not a reporter from any child projects' do + it 'does not allow to add non backlog issues from issue board' do + project_2.add_guest(current_user) + + expect_disallowed(:create_non_backlog_issues) + end + end + end + end end |