Sha256: e60bd82eb7ddefd6ce076b6cbd52f82f00746f9012d8639032180514c72a1cc4
Contents?: true
Size: 1.99 KB
Versions: 5
Compression:
Stored size: 1.99 KB
Contents
# coding: utf-8 require File.dirname(__FILE__) + '/spec_helper.rb' describe ONIX::Normaliser, "with a simple short tag file" do before(:each) do @data_path = File.join(File.dirname(__FILE__),"..","data") @filename = File.join(@data_path, "short_tags.xml") @outfile = @filename + ".new" end after(:each) do File.unlink(@outfile) if File.file?(@outfile) end it "should correctly convert short tag file to reference tag" do ONIX::Normaliser.process(@filename, @outfile) File.file?(@outfile).should be_true content = File.read(@outfile) content.include?("<m174>").should be_false content.include?("<FromCompany>").should be_true end end describe ONIX::Normaliser, "with a short tag file that include HTML tags" do before(:each) do @data_path = File.join(File.dirname(__FILE__),"..","data") @filename = File.join(@data_path, "short_tags_ivp.xml") @outfile = @filename + ".new" end after(:each) do File.unlink(@outfile) if File.file?(@outfile) end it "should correctly convert short tag file to reference tag" do ONIX::Normaliser.process(@filename, @outfile) File.file?(@outfile).should be_true content = File.read(@outfile) content.include?("<m174>").should be_false content.include?("<FromCompany>").should be_true content.include?("<em>Discipleship Essentials</em>").should be_true end end describe ONIX::Normaliser, "with a utf8 file that has illegal control chars" do before(:each) do @data_path = File.join(File.dirname(__FILE__),"..","data") @filename = File.join(@data_path, "control_chars.xml") @outfile = @filename + ".new" end after(:each) do File.unlink(@outfile) if File.file?(@outfile) end it "should remove all control chars except LF, CR and TAB" do ONIX::Normaliser.process(@filename, @outfile) File.file?(@outfile).should be_true content = File.read(@outfile) content.include?("<TitleText>OXFORDPICTURE DICTIONARY CHINESE</TitleText>").should be_true end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
onix-0.9.3 | spec/normaliser_spec.rb |
onix-0.9.2 | spec/normaliser_spec.rb |
onix-0.9.1 | spec/normaliser_spec.rb |
onix-0.9.0 | spec/normaliser_spec.rb |
onix-0.8.5 | spec/normaliser_spec.rb |