From 76f9c52164a2bb5e2194850d4fd5a94df1792773 Mon Sep 17 00:00:00 2001 From: Jerome Pratt Date: Tue, 3 Sep 2024 14:22:43 +0100 Subject: [PATCH] [RUBY-3212] Refactor project name uniqueness validation in spec - Moved the creation of `existing_project` to a `before` block for better readability and consistency. --- spec/steps/pafs_core/project_name_step_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/steps/pafs_core/project_name_step_spec.rb b/spec/steps/pafs_core/project_name_step_spec.rb index b2aa24fe..ffcac1f5 100644 --- a/spec/steps/pafs_core/project_name_step_spec.rb +++ b/spec/steps/pafs_core/project_name_step_spec.rb @@ -46,9 +46,10 @@ end context "when name already exists" do - let!(:existing_project) { create(:project_name_step, name: "Unique Project Name") } let(:duplicate_name_params) { ActionController::Parameters.new({ project_name_step: { name: "Unique Project Name" } }) } + before { create(:project_name_step, name: "Unique Project Name") } + it "returns false and sets the uniqueness error message" do project_name_step.name = "Different Name" expect(project_name_step.update(duplicate_name_params)).to be false