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:
authorFelipe Artur <felipefac@gmail.com>2018-05-28 21:43:46 +0300
committerFelipe Artur <felipefac@gmail.com>2018-06-07 21:47:39 +0300
commitafe5d7d56ee771dac6e4a97d23e69d678c03da2d (patch)
treed4852e794d3c526863eb2ff0bd3d7f399cd40de1 /spec/models/group_spec.rb
parent439adb96dadd49124d080db0db0b0076d2049c6b (diff)
Apply notification settings level of groups to all child objects
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 f83b52e8975..ff35be4a8e3 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) }