File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def initialize(bibitem)
1313 end
1414
1515 def docidentifier
16- @bibitem . docidentifier . first &.content
16+ @bibitem . docidentifier . first &.content &. to_s
1717 end
1818
1919 # def doctype
Original file line number Diff line number Diff line change 9595
9696 context do
9797 let ( :io ) { double "IO" }
98+ let ( :tmpdir ) { Dir . mktmpdir ( "relaton_test_cache" ) }
99+
98100 before ( :each ) do
99101 RSpec ::Mocks . space . proxy_for ( IO ) . reset
100102 expect ( IO ) . to receive ( :new ) do |arg1 , arg2 , &block |
103105 end
104106 end . at_most ( 2 ) . times
105107
108+ # Isolate from global cache by using a fresh DB in a temp directory
109+ Relaton ::Cli ::RelatonDb . instance . instance_variable_set ( :@db , nil )
110+ Relaton ::Cli . relaton ( tmpdir )
111+
106112 # Force to download index file
107113 require "relaton/index"
108114 allow_any_instance_of ( Relaton ::Index ::Type ) . to receive ( :actual? ) . and_return ( false )
109115 allow_any_instance_of ( Relaton ::Index ::FileIO ) . to receive ( :check_file ) . and_return ( nil )
110116 end
111117
118+ after ( :each ) do
119+ Relaton ::Cli ::RelatonDb . instance . instance_variable_set ( :@db , nil )
120+ FileUtils . remove_entry ( tmpdir )
121+ end
122+
112123 it "calls fetch and return XML" do
113124 expect ( io ) . to receive ( :puts ) do |arg |
114125 expect ( arg ) . to match ( /^<bibdata type="standard" schema-version="v\d \. \d \. \d ">/ )
Original file line number Diff line number Diff line change 1- <bibitem id =" ISOTC211 " type =" standard" >
1+ <bibitem id =" ISO55000 " type =" standard" >
22 <fetched >2020-07-04</fetched >
33 <title type =" title-main" format =" text/plain" >Geographic information</title >
44 <title type =" main" format =" text/plain" >Geographic information</title >
88 <uri type =" rss" >https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</uri >
99 <uri type =" doi" >http://standrd.org/doi-123</uri >
1010 <uri type =" file" >file://path/file</uri >
11- <docidentifier primary =" true" type =" ISO" >TC211</docidentifier >
12- <docidentifier type =" isbn" >ISBN</docidentifier >
13- <docidentifier type =" lccn" >LCCN</docidentifier >
14- <docidentifier type =" issn" scope =" series" >ISSN</docidentifier >
11+ <docidentifier primary =" true" type =" ISO" >ISO 55000:2014</docidentifier >
1512 <docnumber >123456</docnumber >
1613 <date type =" issued" >
1714 <on >2014</on >
118115 <language >en</language >
119116 <language >fr</language >
120117 <script >Latn</script >
121- <abstract format =" text/plain" language =" en" script =" Latn" >ISO 19115-1 :2014 defines the schema required for ...</abstract >
122- <abstract format =" text/plain" language =" fr" script =" Latn" >L'ISO 19115-1 :2014 définit le schéma requis pour ...</abstract >
118+ <abstract format =" text/plain" language =" en" script =" Latn" >ISO 55000:2014 :2014 defines the schema required for ...</abstract >
119+ <abstract format =" text/plain" language =" fr" script =" Latn" >L'ISO 55000:2014 :2014 définit le schéma requis pour ...</abstract >
123120 <status >
124121 <stage abbreviation =" CD" >30</stage >
125122 <substage >substage</substage >
Original file line number Diff line number Diff line change 33 <title type =" main" >Geographic information</title >
44 <title language =" fr" script =" Latn" type =" title-main" >Information géographique</title >
55 <title language =" fr" script =" Latn" type =" main" >Information géographique</title >
6- <docidentifier type =" ISO" primary =" true" >TC211 </docidentifier >
6+ <docidentifier type =" ISO" primary =" true" >ISO 55000:2014 </docidentifier >
77 <date type =" issued" >
88 <on >2014</on >
99 </date >
Original file line number Diff line number Diff line change 1313 script : Latn
1414 type : main
1515docidentifier :
16- - content : TC211
16+ - content : ISO 55000:2014
1717 type : ISO
1818 primary : true
1919date :
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ def db_mock(dir)
130130
131131 context "return BibTex" do
132132 it do
133- out = "@manual{ISOTC211 , tile = {Geographic information}}"
133+ out = "@manual{ISO55000 , tile = {Geographic information}}"
134134 bib = double "BibItem" , to_bibtex : out
135135 expect ( io ) . to receive ( :puts ) . with ( out )
136136 expect ( db ) . to receive ( :fetch_all ) do |arg |
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments