diff options
author | Ruben Davila <rdavila84@gmail.com> | 2017-09-07 21:35:45 +0300 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2017-09-07 21:47:58 +0300 |
commit | 62bb6235c229a869052180f9709c4801116f02cc (patch) | |
tree | a28626180edfe5f8abef6e5e2e44a2128c636f49 /spec/requests | |
parent | bc955cfc8e75e17897ab25717176209fefbba915 (diff) |
Make Members with Owner and Master roles always able to create subgroups
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/groups_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 77c43f92456..42f0079e173 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -431,6 +431,30 @@ describe API::Groups do expect(response).to have_http_status(403) end + + context 'as owner', :nested_groups do + before do + group2.add_owner(user1) + end + + it 'can create subgroups' do + post api("/groups", user1), parent_id: group2.id, name: 'foo', path: 'foo' + + expect(response).to have_http_status(201) + end + end + + context 'as master', :nested_groups do + before do + group2.add_master(user1) + end + + it 'cannot create subgroups' do + post api("/groups", user1), parent_id: group2.id, name: 'foo', path: 'foo' + + expect(response).to have_http_status(403) + end + end end context "when authenticated as user with group permissions" do |