[Hotfix] Allow blank values for payment_pointer (#11786)

This commit is contained in:
rhymes 2020-12-07 18:18:40 +01:00 committed by GitHub
parent bd9e83de6c
commit f6d73fea8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -213,7 +213,7 @@ class User < ApplicationRecord
validates :inbox_type, inclusion: { in: INBOXES }
validates :name, length: { in: 1..100 }
validates :password, length: { in: 8..100 }, allow_nil: true
validates :payment_pointer, format: PAYMENT_POINTER_REGEXP, allow_nil: true
validates :payment_pointer, format: PAYMENT_POINTER_REGEXP, allow_blank: true
validates :rating_votes_count, presence: true
validates :reactions_count, presence: true
validates :sign_in_count, presence: true

View file

@ -191,6 +191,7 @@ RSpec.describe User, type: :model do
it { is_expected.not_to allow_value("example.com/value").for(:payment_pointer) }
it { is_expected.to allow_value(" $example.com/value ").for(:payment_pointer) }
it { is_expected.to allow_value(nil).for(:payment_pointer) }
it { is_expected.to allow_value("").for(:payment_pointer) }
it { is_expected.to validate_inclusion_of(:inbox_type).in_array(%w[open private]) }