Skip to content

Commit

Permalink
Finishing touches 2
Browse files Browse the repository at this point in the history
  • Loading branch information
MotorTruck1221 committed Aug 16, 2023
1 parent 2eb54ad commit 15679af
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions ruby/yamlValidator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,24 @@ class YamlValidator < Dry::Validation::Contract
if (Settings.private == "false")
key.failure('must have a url') if value !~ /\A#{URI::regexp(['http', 'https'])}\z/
key.failure('must have a / at the end') if value !~ /\/\z/
key.failure('The username MUST be "ruby"') if Settings.username != "ruby"
key.failure('The password MUST be "ruby"') if Settings.password != "ruby"
else
key.failure('must have no url') if value != "NA"
key.failure('The username MUST be "ruby"') if Settings.username != "ruby"
key.failure('The password MUST be "ruby"') if Settings.password != "ruby"
end
end
rule(:username) do
if (Settings.private == "false")
key.failure('the username MUST be "ruby"') if value != "ruby"
end
if (Settings.private == "true")
key.failure('the username must NOT be "ruby"') if value == "ruby"
end
end
rule(:password) do
if (Settings.private == "false")
key.failure('the password MUST be "ruby"') if value != "ruby"
end
if (Settings.private == "true")
key.failure('the password must NOT be "ruby"') if value == "ruby"
end
end
end
Expand Down

0 comments on commit 15679af

Please sign in to comment.