File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -20,12 +20,24 @@ class YamlValidator < Dry::Validation::Contract
20
20
if ( Settings . private == "false" )
21
21
key . failure ( 'must have a url' ) if value !~ /\A #{ URI ::regexp ( [ 'http' , 'https' ] ) } \z /
22
22
key . failure ( 'must have a / at the end' ) if value !~ /\/ \z /
23
- key . failure ( 'The username MUST be "ruby"' ) if Settings . username != "ruby"
24
- key . failure ( 'The password MUST be "ruby"' ) if Settings . password != "ruby"
25
23
else
26
24
key . failure ( 'must have no url' ) if value != "NA"
27
- key . failure ( 'The username MUST be "ruby"' ) if Settings . username != "ruby"
28
- key . failure ( 'The password MUST be "ruby"' ) if Settings . password != "ruby"
25
+ end
26
+ end
27
+ rule ( :username ) do
28
+ if ( Settings . private == "false" )
29
+ key . failure ( 'the username MUST be "ruby"' ) if value != "ruby"
30
+ end
31
+ if ( Settings . private == "true" )
32
+ key . failure ( 'the username must NOT be "ruby"' ) if value == "ruby"
33
+ end
34
+ end
35
+ rule ( :password ) do
36
+ if ( Settings . private == "false" )
37
+ key . failure ( 'the password MUST be "ruby"' ) if value != "ruby"
38
+ end
39
+ if ( Settings . private == "true" )
40
+ key . failure ( 'the password must NOT be "ruby"' ) if value == "ruby"
29
41
end
30
42
end
31
43
end
You can’t perform that action at this time.
0 commit comments