-
Notifications
You must be signed in to change notification settings - Fork 983
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
fixes #10232 - moving validations and casting out of lookup key and value #2399
fixes #10232 - moving validations and casting out of lookup key and value #2399
Conversation
Please check the rubocop and unit test failures, thanks. |
04549a6
to
6e343a5
Compare
6e343a5
to
28b7bed
Compare
context "failues" do | ||
test "caster cowardly doesn't make any change in case it doesn't know how to cast" do | ||
item = OpenStruct.new(:foo => "blah") | ||
#assert_raises TypeError do |
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.
Commented code here and below
@ares would you mind giving this look over, since you've spent some time in this area? It looks minimally invasive to me, just moving code rather than behavioural changes. |
@@ -0,0 +1,118 @@ | |||
module Parameters |
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.
Could we put this under the Foreman namespace too? e.g. Foreman::Parameters::Caster
28b7bed
to
cc1a85e
Compare
module Parameters | ||
class Caster | ||
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE', 'on', 'ON', 'yes', 'YES', 'y', 'Y'].to_set | ||
FALSE_VALUES = [false, 0, '0', 'f', 'F', 'false', 'FALSE', 'off', 'OFF', 'no', 'NO', 'n', 'N'].to_set |
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.
both unused?
Please note that not all of my previous comments were addressed. |
@@ -214,7 +207,7 @@ def array2path(array) | |||
def validate_and_cast_default_value |
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.
Misnamed, should be cast only.
f368890
to
942ca23
Compare
@domcleal - fixed your comments |
942ca23
to
19a989c
Compare
@@ -6,6 +6,7 @@ | |||
factory :environment_class | |||
|
|||
factory :lookup_key do | |||
key_type "string" |
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.
Also not required.
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.
done
19a989c
to
93c64c4
Compare
… key and value
93c64c4
to
a07a28a
Compare
@domcleal I rebased and fixed the factory. |
Merged as 9f88e8a, thanks @unorthodoxgeek and @orrabin. |
No description provided.