diff options
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r-- | spec/models/group_spec.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 0acf2b96b74..2ac00b6231e 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -410,7 +410,7 @@ RSpec.describe Group do it "is false if avatar is html page" do group.update_attribute(:avatar, 'uploads/avatar.html') - expect(group.avatar_type).to eq(["file format is not supported. Please try one of the following supported formats: png, jpg, jpeg, gif, bmp, tiff, ico"]) + expect(group.avatar_type).to eq(["file format is not supported. Please try one of the following supported formats: png, jpg, jpeg, gif, bmp, tiff, ico, webp"]) end end @@ -1492,6 +1492,28 @@ RSpec.describe Group do end end + describe '.preset_root_ancestor_for' do + let_it_be(:rootgroup, reload: true) { create(:group) } + let_it_be(:subgroup, reload: true) { create(:group, parent: rootgroup) } + let_it_be(:subgroup2, reload: true) { create(:group, parent: subgroup) } + + it 'does noting for single group' do + expect(subgroup).not_to receive(:self_and_ancestors) + + described_class.preset_root_ancestor_for([subgroup]) + end + + it 'sets the same root_ancestor for multiple groups' do + expect(subgroup).not_to receive(:self_and_ancestors) + expect(subgroup2).not_to receive(:self_and_ancestors) + + described_class.preset_root_ancestor_for([rootgroup, subgroup, subgroup2]) + + expect(subgroup.root_ancestor).to eq(rootgroup) + expect(subgroup2.root_ancestor).to eq(rootgroup) + end + end + def subject_and_reload(*models) subject models.map(&:reload) |