Skip to content

Commit a845be7

Browse files
committed
Fix bad ORCIDs in tests
1 parent ca24979 commit a845be7

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

test/models/person_test.rb

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ class PersonTest < ActiveSupport::TestCase
4848

4949
test 'should automatically link to profile by orcid on save' do
5050
profile = profiles(:trainer_one_profile)
51-
# The trainer_one_profile has orcid: https://orcid.org/000-0002-1825-0097
52-
person = Person.create(full_name: 'Josiah Carberry', orcid: 'https://orcid.org/000-0002-1825-0097')
51+
# The trainer_one_profile has orcid: https://orcid.org/0000-0002-1825-0097
52+
person = Person.create(full_name: 'Josiah Carberry', orcid: 'https://orcid.org/0000-0002-1825-0097')
5353
assert person.valid?
5454
assert_equal profile, person.profile
5555
end
5656

5757
test 'should automatically link to profile using short orcid format' do
5858
profile = profiles(:trainer_one_profile)
59-
# The trainer_one_profile has orcid: https://orcid.org/000-0002-1825-0097
60-
person = Person.create(full_name: 'Josiah Carberry', orcid: '000-0002-1825-0097')
59+
# The trainer_one_profile has orcid: https://orcid.org/0000-0002-1825-0097
60+
person = Person.create(full_name: 'Josiah Carberry', orcid: '0000-0002-1825-0097')
6161
assert person.valid?
6262
assert_equal profile, person.profile
6363
end
@@ -68,6 +68,18 @@ class PersonTest < ActiveSupport::TestCase
6868
assert_nil person.profile
6969
end
7070

71+
test 'should should break profile link if orcid removed' do
72+
profile = profiles(:trainer_one_profile)
73+
# The trainer_one_profile has orcid: https://orcid.org/0000-0002-1825-0097
74+
person = Person.create(full_name: 'Josiah Carberry', orcid: '0000-0002-1825-0097', profile: profile)
75+
assert person.valid?
76+
assert_equal profile, person.profile
77+
78+
person.update(orcid: nil)
79+
assert_nil person.profile
80+
end
81+
82+
7183
test 'should not override existing profile link' do
7284
profile1 = profiles(:trainer_one_profile)
7385
profile2 = profiles(:admin_trainer_profile)
@@ -77,7 +89,7 @@ class PersonTest < ActiveSupport::TestCase
7789
assert_equal profile2, person.profile
7890

7991
# Even if we update the ORCID to match profile1, it should keep profile2
80-
person.update(orcid: 'https://orcid.org/000-0002-1825-0097')
92+
refute person.update(orcid: '0000-0002-1825-0097')
8193
assert_equal profile2, person.profile
8294
end
8395
end

0 commit comments

Comments
 (0)