Fix instagram URL validation rule (#3336)
This commit is contained in:
parent
29e0f5597c
commit
6797567de9
2 changed files with 2 additions and 2 deletions
|
|
@ -93,7 +93,7 @@ class User < ApplicationRecord
|
|||
format: /\A(http(s)?:\/\/)?(www.gitlab.com|gitlab.com)\/.*\Z/
|
||||
validates :instagram_url,
|
||||
allow_blank: true,
|
||||
format: /\A(http(s)?:\/\/)?(www.instagram.com|instagram.com)\/[a-z\d_]{1,30}\Z/
|
||||
format: /\A(http(s)?:\/\/)?(?:www.)?instagram.com\/(?=.{1,30}\/?$)([a-zA-Z\d_]\.?)*[a-zA-Z\d_]+\/?\Z/
|
||||
validates :twitch_url,
|
||||
allow_blank: true,
|
||||
format: /\A(http(s)?:\/\/)?(www.twitch.tv|twitch.tv)\/.*\Z/
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ RSpec.describe User, type: :model do
|
|||
end
|
||||
|
||||
it "accepts valid instagram url" do
|
||||
%w[jess je_ss].each do |username|
|
||||
%w[jess je_ss je_ss.tt A.z.E.r.T.y].each do |username|
|
||||
user.instagram_url = "https://instagram.com/#{username}"
|
||||
expect(user).to be_valid
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue