-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate settings even if loader does not set value #246
Conversation
it "defines the setting" do | ||
expect(container[:settings].some_int_using_deprecated_key).to eq 5 | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to tweak this because this spec 👇 was failing with a validation error.
settings_obj.config.public_send(:"#{setting_name}=", value) | ||
else | ||
settings_obj.config[setting_name] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, if the loaded doesn't find a value, we still evaluate the setting to make sure the constructor is happy with the setting being nil
.
@solnic is there anything I can do to move this along? |
@oeoeaio Thank you for submitting this, and sorry for the delay here! I've actually just addressed this same issue in Hanami (hanami/hanami#1222), which does not use the dry-system settings plugin but does a very similar thing. I can commit to checking out your PR sometime in the next ~week and have it be released. |
That would be great, thanks @timriley. |
Thanks for taking care of this, @oeoeaio! This fix is perfect :) |
Resolves #245
This is probably not the right way to solve this, but it gives the intended effect.