File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -574,7 +574,7 @@ def orcid_as_url(orcid)
574574 end
575575
576576 def validate_orcid ( orcid )
577- orcid = Array ( /\A (?:(http|https):\/ \/ (www\. )?orcid\. org\/ )?(\d {4}[[:space:]-]\d {4}[[:space:]-]\d {4}[[:space:]-]\d {3}[0-9X]+)\z / . match ( orcid ) ) . last
577+ orcid = Array ( /\A (?:(?: http|https):\/ \/ (?:(?: www|sandbox)? \. )?orcid\. org\/ )?(\d {4}[[:space:]-]\d {4}[[:space:]-]\d {4}[[:space:]-]\d {3}[0-9X]+)\z / . match ( orcid ) ) . last
578578 orcid . gsub ( /[[:space:]]/ , "-" ) if orcid . present?
579579 end
580580
Original file line number Diff line number Diff line change 6464 expect ( response ) . to eq ( "0000-0002-1394-3097" )
6565 end
6666
67+ it "validate_orcid sandbox" do
68+ orcid = "http://sandbox.orcid.org/0000-0002-2590-225X"
69+ response = subject . validate_orcid ( orcid )
70+ expect ( response ) . to eq ( "0000-0002-2590-225X" )
71+ end
72+
73+ it "validate_orcid sandbox https" do
74+ orcid = "https://sandbox.orcid.org/0000-0002-2590-225X"
75+ response = subject . validate_orcid ( orcid )
76+ expect ( response ) . to eq ( "0000-0002-2590-225X" )
77+ end
78+
6779 it "validate_orcid wrong id" do
6880 orcid = "0000-0002-1394-309"
6981 response = subject . validate_orcid ( orcid )
You can’t perform that action at this time.
0 commit comments