mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 09:42:46 +08:00
Add Archived to ProjectFolder name uniqueness scope
SCI-5417
This commit is contained in:
parent
e3388b880c
commit
68ac663370
2 changed files with 3 additions and 2 deletions
|
@ -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? }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue