Skip to content

Commit

Permalink
[RUBY-3212] Refactor project name uniqueness validation in spec
Browse files Browse the repository at this point in the history
- Moved the creation of `existing_project` to a `before` block for better readability and consistency.
  • Loading branch information
jjromeo committed Sep 3, 2024
1 parent 079d25a commit 76f9c52
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion spec/steps/pafs_core/project_name_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 76f9c52

Please sign in to comment.