Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/models/enterprise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:/\A\S+\Z/ },

Check warning on line 131 in app/models/enterprise.rb

View workflow job for this annotation

GitHub Actions / runner / rubocop

[rubocop] reported by reviewdog 🐶 Space missing after colon. Raw Output: app/models/enterprise.rb:131:27: C: Layout/SpaceAfterColon: Space missing after colon.
allow_blank: true

before_validation :initialize_permalink, if: lambda { permalink.nil? }
before_validation :set_unused_address_fields
Expand Down
7 changes: 7 additions & 0 deletions spec/models/enterprise_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,13 @@
expect(e).not_to be_valid
end
end

describe "external_billing_id" do
it "does not validate the external_billing_id attribute with a space" do
e = build(:enterprise, external_billing_id: 'with spaces')
expect(e).not_to be_valid
end
end
end

describe "serialisation" do
Expand Down
Loading