Commit bd0b030b authored by Alex Kalderimis's avatar Alex Kalderimis

Add regression tests for internal and private groups

parent c4203653
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe GroupMemberPolicy do RSpec.describe GroupMemberPolicy do
include DesignManagementTestHelpers
let(:guest) { create(:user) } let(:guest) { create(:user) }
let(:owner) { create(:user) } let(:owner) { create(:user) }
let(:group) { create(:group, :private) } let(:group) { create(:group, :private) }
...@@ -34,9 +36,36 @@ RSpec.describe GroupMemberPolicy do ...@@ -34,9 +36,36 @@ RSpec.describe GroupMemberPolicy do
let(:membership) { guest.members.first } let(:membership) { guest.members.first }
it do it do
expect_disallowed(*member_related_permissions) expect_disallowed(:read_design_activity, *member_related_permissions)
expect_allowed(:read_group) expect_allowed(:read_group)
end end
context 'design management is enabled' do
before do
create(:project, :public, group: group) # Necessary to enable design management
enable_design_management
end
specify do
expect_allowed(:read_design_activity)
end
end
context 'for a private group' do
let(:group) { create(:group, :private) }
specify do
expect_disallowed(:read_group, *member_related_permissions)
end
end
context 'for an internal group' do
let(:group) { create(:group, :internal) }
specify do
expect_disallowed(:read_group, *member_related_permissions)
end
end
end end
context 'with guest user, for own membership' do context 'with guest user, for own membership' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment