Add Archived to ProjectFolder name uniqueness scope

SCI-5417
This commit is contained in:
Urban Rotnik 2021-01-22 08:50:47 +01:00
parent e3388b880c
commit 68ac663370
2 changed files with 3 additions and 2 deletions

View file

@ -8,7 +8,7 @@ class ProjectFolder < ApplicationRecord
validates :name,
length: { minimum: Constants::NAME_MIN_LENGTH,
maximum: Constants::NAME_MAX_LENGTH },
uniqueness: { scope: %i(team_id parent_folder_id), case_sensitive: false }
uniqueness: { scope: %i(team_id parent_folder_id archived), case_sensitive: false }
validate :parent_folder_team, if: -> { parent_folder.present? }
validate :parent_folder_validation, if: -> { parent_folder.present? }

View file

@ -37,7 +37,8 @@ describe ProjectFolder, type: :model do
.is_at_most(Constants::NAME_MAX_LENGTH))
end
it do
expect(project_folder).to validate_uniqueness_of(:name).scoped_to(%i(team_id parent_folder_id)).case_insensitive
expect(project_folder)
.to validate_uniqueness_of(:name).scoped_to(%i(team_id parent_folder_id archived)).case_insensitive
end
end