-
-
Notifications
You must be signed in to change notification settings - Fork 729
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
Do not allow spaces in external billing #13081
base: master
Are you sure you want to change the base?
Do not allow spaces in external billing #13081
Conversation
dbb2515
to
39825a9
Compare
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.
Can you address the rubocop warning ?
@rioug I have requested the merge of the last master changes, and it seems that the Rubocop warning is gone, but now I have a test failing, it seems to be a flaky one. Do you know waht to do in this case? Can I trigger the checks without pushing a commit? |
On your fork you should be able to, but probably not in the OFN repo, but I can :) All good now, thanks ! |
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.
Looks good 👍
app/models/enterprise.rb
Outdated
@@ -127,6 +127,9 @@ class Enterprise < ApplicationRecord | |||
message: Spree.t('errors.messages.invalid_instagram_url') | |||
}, allow_blank: true | |||
validate :validate_white_label_logo_link | |||
validates :external_billing_id, | |||
format: { with: /\A\S+\Z/ }, |
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.
I wasn't familiar with the \A
or \Z
, so I tested this out. A website like regexr.com is really handy for testing and perfecting regular expressions.
I don't think this is what was intended, and it would always be considered invalid. Can you please add at least one other test to ensure that a valid Billing ID is validated correctly.
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.
@@ -127,6 +127,9 @@ | |||
message: Spree.t('errors.messages.invalid_instagram_url') | |||
}, allow_blank: true | |||
validate :validate_white_label_logo_link | |||
validates :external_billing_id, | |||
format: { with: /^\S+$/ }, |
Check failure
Code scanning / Brakeman
Insufficient validation for external_billing_id using /^\S+$/. Use \A and \z as anchors. Error
What? Why?
I forgot to add a basic validation on the external_billing_id field on my last PR.
What should we test?
Release notes
Changelog Category (reviewers may add a label for the release notes):