-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RUBY 3212 pafs proposals with duplicate names are not sent to pipeline (
#903) * [RUBY-3212] Add validation for unique project names in `PafsCore::ProjectNameStep` spec - Added a new context to test for duplicate project names. - Ensures that the model returns false and sets an error message when a duplicate project name is provided. * [RUBY-3212] Refactor `name_must_be_unique` method for readability - Simplified `name_must_be_unique` method using `return unless` to improve readability and reduce nesting. * [RUBY-3220] Add back shared example to `project_name_step_spec.rb` * [RUBY-3212] Refactor project name uniqueness validation in spec - Moved the creation of `existing_project` to a `before` block for better readability and consistency. * [RUBY-3212] Add unique index to `projects` name - Created migration to add unique index to `pafs_core_projects` table on the `name` column. - Updated schema to reflect the new unique index on the `name` column. * [RUBY-3212] Update migration class to inherit from ActiveRecord::Migration[7.1] - Changed inheritance of `AddUniqueIndexToProjectsName` from `ActiveRecord::Migration[7.2]` to `ActiveRecord::Migration[7.1]` * [RUBY-3212] Remove redundant assignment in `project_name_step` uniqueness test
- Loading branch information
Showing
4 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
db/migrate/20240904104418_add_unique_index_to_projects_name.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddUniqueIndexToProjectsName < ActiveRecord::Migration[7.1] | ||
def change | ||
add_index :pafs_core_projects, :name, unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters