From c9c1ed949568271bc95ed63b4d2fddf3dda3e62d Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Tue, 20 May 2025 16:23:00 -0600 Subject: [PATCH 1/2] Fix creator & commenter traits in plans factory - Prior to this change, rather than assigning the desired role to the newly created plan, executing `create(:plan, :creator...` or `create(:plan, :commenter...` would create a second new plan. - This code change makes sure that when the `creator` or `commenter` trait is specified, it is applied to the first created plan and a second one is not created. --- spec/factories/plans.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/factories/plans.rb b/spec/factories/plans.rb index c07d002ec7..5a8b5789bb 100644 --- a/spec/factories/plans.rb +++ b/spec/factories/plans.rb @@ -62,13 +62,13 @@ guidance_groups { 0 } end trait :creator do - after(:create) do |obj| - obj.roles << create(:role, :creator, user: create(:user, org: create(:org))) + after(:create) do |plan| + plan.roles << create(:role, :creator, user: create(:user, org: create(:org)), plan: plan) end end trait :commenter do - after(:create) do |obj| - obj.roles << create(:role, :commenter, user: create(:user, org: create(:org))) + after(:create) do |plan| + plan.roles << create(:role, :commenter, user: create(:user, org: create(:org)), plan: plan) end end trait :organisationally_visible do From f6f04439fd5a71acf3ffe6dda88dda1408aa9101 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Tue, 20 May 2025 16:39:30 -0600 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c06babae56..29d57edaea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changelog +- Fix `:creator` & `:commenter` traits in plans factory [#3526](https://github.com/DMPRoadmap/roadmap/pull/3526) - Updated seeds.rb file for identifier_schemes to include context value and removed logo_url and idenitifier_prefix for Shibboleth (as it was causing issues with SSO). [#3525](https://github.com/DMPRoadmap/roadmap/pull/3525) - Adjustments to style of select tags and plan download layout [#3509](https://github.com/DMPRoadmap/roadmap/pull/3509) - Fix failing eslint workflow / upgrade `actions/checkout` & `actions/setup-node` to v3 [#3503](https://github.com/DMPRoadmap/roadmap/pull/3503)