File tree 3 files changed +32
-4
lines changed
3 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,11 @@ def identifier_link(identifier)
57
57
when 'doi'
58
58
link_to identifier . body , "https://doi.org/#{ identifier . body } "
59
59
when 'iss_itemno'
60
- link_to identifier . body , "https://ndlsearch.ndl.go.jp/books/#{ identifier . body } "
60
+ if identifier . body =~ /\A R[0-9A-Za-z]+?-I[0-9A-Za-z]+?-00\z /
61
+ link_to identifier . body , "https://iss.ndl.go.jp/books/#{ identifier . body } "
62
+ else
63
+ link_to identifier . body , "https://ndlsearch.ndl.go.jp/books/#{ identifier . body } "
64
+ end
61
65
when 'lccn'
62
66
link_to identifier . body , "https://lccn.loc.gov/#{ identifier . body } "
63
67
when 'ncid'
Original file line number Diff line number Diff line change 1
1
FactoryBot . define do
2
2
factory :identifier do
3
3
sequence ( :body ) { |n | "identifier_body_#{ n } " }
4
- identifier_type_id { FactoryBot . create ( :identifier_type ) . id }
5
- association ( :manifestation )
4
+ association :identifier_type
5
+ association :manifestation
6
6
end
7
7
end
8
8
Original file line number Diff line number Diff line change 7
7
expect ( helper . form_icon ( nil ) ) . to match /src=\" \/ assets\/ icons\/ help-/
8
8
end
9
9
10
- it "should render form_icon if carrier_type's attachment is blank " do
10
+ it "should render form_icon if carrier_type's attachment is blank" do
11
11
expect ( helper . form_icon ( FactoryBot . create ( :carrier_type ) ) ) . to match /src=\" \/ assets\/ icons\/ help-/
12
12
end
13
+
14
+ it "should link to old NDL search if iss_itemno ends with '-00'" do
15
+ expect (
16
+ helper . identifier_link (
17
+ FactoryBot . build (
18
+ :identifier ,
19
+ body : 'R100000039-I001413988-00' ,
20
+ identifier_type : IdentifierType . find_by ( name : 'iss_itemno' )
21
+ )
22
+ )
23
+ ) . to eq "<a href=\" https://iss.ndl.go.jp/books/R100000039-I001413988-00\" >R100000039-I001413988-00</a>"
24
+ end
25
+
26
+ it "should link to new NDL search if iss_itemno doesn't end with '-00'" do
27
+ expect (
28
+ helper . identifier_link (
29
+ FactoryBot . build (
30
+ :identifier ,
31
+ body : 'R100000039-I001413988' ,
32
+ identifier_type : IdentifierType . find_by ( name : 'iss_itemno' )
33
+ )
34
+ )
35
+ ) . to eq "<a href=\" https://ndlsearch.ndl.go.jp/books/R100000039-I001413988\" >R100000039-I001413988</a>"
36
+ end
13
37
end
You can’t perform that action at this time.
0 commit comments