Skip to content

Commit 6457d5a

Browse files
committed
Set/Override config.default_funder_name for tests
The 'User creates a new Plan' test will not pass unless an org exists within the db such that `org.name == Rails.application.config.default_funder_name`. However, we have `config.default_funder_name = Rails.application.secrets.default_funder_name` within `config/application.rb`. This secret is not read while executing the tests via our GitHub actions and the following error is encountered: ``` 1) Plans User creates a new Plan Failure/Error: @funding_org = create(:org, :funder, templates: 1, name: Rails.application.config.default_funder_name) ActiveRecord::RecordInvalid: Validation failed: Name can't be blank # ./spec/features/plans_spec.rb:13:in `block (2 levels) in <top (required)>' ``` Thus, we are overriding/setting that value within the test itself.
1 parent e397de7 commit 6457d5a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

spec/features/plans_spec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
@org = create(:org)
1111
@research_org = create(:org, :organisation, :research_institute,
1212
name: 'Test Research Org', templates: 1)
13+
Rails.application.config.default_funder_name = 'Test Funder'
1314
@funding_org = create(:org, :funder, templates: 1, name: Rails.application.config.default_funder_name)
1415
@template = create(:template, org: @org)
1516
@user = create(:user, org: @org)

0 commit comments

Comments
 (0)