Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-06-07 23:10:45 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-06-07 23:10:45 +0300
commit6e614bd5e03e55a6b64a89b1cdbf2973bdd6ca84 (patch)
treed5b71bf7d2f32e5f4fc8fdb658762e343433a869 /spec/models/group_spec.rb
parent27aa2e544b9f97b701888bd17d517c5f2b697f91 (diff)
parentafe5d7d56ee771dac6e4a97d23e69d678c03da2d (diff)
Merge branch 'issue_44230' into 'master'
Apply notification settings level of groups to all child objects Closes #44230 See merge request gitlab-org/gitlab-ce!19191
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r--spec/models/group_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index 8f1f4938065..9fe1186a8c9 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -67,6 +67,30 @@ describe Group do
end
end
+ describe '#notification_settings', :nested_groups do
+ let(:user) { create(:user) }
+ let(:group) { create(:group) }
+ let(:sub_group) { create(:group, parent_id: group.id) }
+
+ before do
+ group.add_developer(user)
+ sub_group.add_developer(user)
+ end
+
+ it 'also gets notification settings from parent groups' do
+ expect(sub_group.notification_settings.size).to eq(2)
+ expect(sub_group.notification_settings).to include(group.notification_settings.first)
+ end
+
+ context 'when sub group is deleted' do
+ it 'does not delete parent notification settings' do
+ expect do
+ sub_group.destroy
+ end.to change { NotificationSetting.count }.by(-1)
+ end
+ end
+ end
+
describe '#visibility_level_allowed_by_parent' do
let(:parent) { create(:group, :internal) }
let(:sub_group) { build(:group, parent_id: parent.id) }