Allow stackoverflow subcommunities profiles (#3215)
This commit is contained in:
parent
24328417ab
commit
b284c1e9df
2 changed files with 15 additions and 1 deletions
|
|
@ -80,7 +80,7 @@ class User < ApplicationRecord
|
|||
validates :stackoverflow_url,
|
||||
allow_blank: true,
|
||||
format:
|
||||
/\A(http(s)?:\/\/)?(www.stackoverflow.com|stackoverflow.com|www.stackexchange.com|stackexchange.com)\/.*\Z/
|
||||
/\A(http(s)?:\/\/)?(((www|pt|ru|es|ja).)?stackoverflow.com|(www.)?stackexchange.com)\/.*\Z/
|
||||
validates :behance_url,
|
||||
allow_blank: true,
|
||||
format: /\A(http(s)?:\/\/)?(www.behance.net|behance.net)\/.*\Z/
|
||||
|
|
|
|||
|
|
@ -194,6 +194,20 @@ RSpec.describe User, type: :model do
|
|||
expect(user).not_to be_valid
|
||||
end
|
||||
|
||||
it "accepts valid stackoverflow sub community url" do
|
||||
%w[pt ru es ja].each do |subcommunity|
|
||||
user.stackoverflow_url = "https://#{subcommunity}.stackoverflow.com/users/7381391/mazen"
|
||||
expect(user).to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
it "does not accept invalid stackoverflow sub community url" do
|
||||
user.stackoverflow_url = "https://fr.stackoverflow.com/users/7381391/mazen"
|
||||
expect(user).not_to be_valid
|
||||
end
|
||||
|
||||
|
||||
it "accepts valid https linkedin url" do
|
||||
%w[jessleenyc jessleenyc/ jess-lee-nyc].each do |username|
|
||||
user.linkedin_url = "https://linkedin.com/in/#{username}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue