From 68ac663370df582204029c6f190264e14e18aa32 Mon Sep 17 00:00:00 2001 From: Urban Rotnik Date: Fri, 22 Jan 2021 08:50:47 +0100 Subject: [PATCH] Add Archived to ProjectFolder name uniqueness scope SCI-5417 --- app/models/project_folder.rb | 2 +- spec/models/project_folder_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/project_folder.rb b/app/models/project_folder.rb index 508a8a656..f529f7c0e 100644 --- a/app/models/project_folder.rb +++ b/app/models/project_folder.rb @@ -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? } diff --git a/spec/models/project_folder_spec.rb b/spec/models/project_folder_spec.rb index 81e733fa2..2f231bb5e 100644 --- a/spec/models/project_folder_spec.rb +++ b/spec/models/project_folder_spec.rb @@ -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