diff options
author | Felipe Artur <felipefac@gmail.com> | 2018-05-28 15:43:46 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2018-06-07 15:47:39 -0300 |
commit | afe5d7d56ee771dac6e4a97d23e69d678c03da2d (patch) | |
tree | d4852e794d3c526863eb2ff0bd3d7f399cd40de1 /spec/models/group_spec.rb | |
parent | 439adb96dadd49124d080db0db0b0076d2049c6b (diff) | |
download | gitlab-ce-afe5d7d56ee771dac6e4a97d23e69d678c03da2d.tar.gz |
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.rb | 24 |
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) } |