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:
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r--spec/models/group_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index c03fcdb6f9c..6ba450b6d57 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -99,6 +99,15 @@ RSpec.describe Group do
expect(group).to be_valid
end
+
+ it 'does not allow a subgroup to have the same name as an existing subgroup' do
+ sub_group1 = create(:group, parent: group, name: "SG", path: 'api')
+ sub_group2 = described_class.new(parent: group, name: "SG", path: 'api2')
+
+ expect(sub_group1).to be_valid
+ expect(sub_group2).not_to be_valid
+ expect(sub_group2.errors.full_messages.to_sentence).to eq('Name has already been taken')
+ end
end
end