test/xml_util_test.rb in exlibris-primo-1.0.8 vs test/xml_util_test.rb in exlibris-primo-1.0.9

- old
+ new

@@ -18,6 +18,27 @@ assert_nothing_raised { record = Exlibris::Primo::Record.new(:raw_xml => "<record><control><recordid>123456</recordid></control></record>\n") assert_equal "{\"record\":{\"control\":{\"recordid\":\"123456\"}}}", record.to_json } end -end \ No newline at end of file + + def test_primo_central_record_to_xml + assert_nothing_raised { + record = Exlibris::Primo::Record.new(:raw_xml => "<prim:record><prim:control><prim:recordid>123456</prim:recordid></prim:control></prim:record>\n", :namespaces => {"xmlns:prim" => "http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib"}) + assert_equal "<record><control><recordid>123456</recordid></control></record>", record.to_xml + } + end + + def test_primo_central_record_to_hash + assert_nothing_raised { + record = Exlibris::Primo::Record.new(:raw_xml => "<prim:record><prim:control><prim:recordid>123456</prim:recordid></prim:control></prim:record>\n", :namespaces => {"xmlns:prim" => "http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib"}) + assert_equal({"record"=> { "control" => { "recordid"=> "123456" } } }, record.to_hash) + } + end + + def test_primo_central_record_to_json + assert_nothing_raised { + record = Exlibris::Primo::Record.new(:raw_xml => "<prim:record><prim:control><prim:recordid>123456</prim:recordid></prim:control></prim:record>\n", :namespaces => {"xmlns:prim" => "http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib"}) + assert_equal "{\"record\":{\"control\":{\"recordid\":\"123456\"}}}", record.to_json + } + end +end