diff options
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/group_spec.rb | 9 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 2 |
2 files changed, 10 insertions, 1 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 diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 184500f3209..e76cd22d342 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -598,7 +598,7 @@ RSpec.describe Project, factory_default: :keep do end it 'contains errors related to the project being deleted' do - expect(new_project.errors.full_messages.first).to eq(_('The project is still being deleted. Please try again later.')) + expect(new_project.errors.full_messages).to include(_('The project is still being deleted. Please try again later.')) end end |