spec/normaliser_spec.rb in onix-0.8.4 vs spec/normaliser_spec.rb in onix-0.8.5
- old
+ new
@@ -1,10 +1,10 @@
# coding: utf-8
require File.dirname(__FILE__) + '/spec_helper.rb'
-context "ONIX::Normaliser", "with a simple short tag file" do
+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"
@@ -12,22 +12,45 @@
after(:each) do
File.unlink(@outfile) if File.file?(@outfile)
end
- specify "should correctly convert short tag file to reference tag" do
+ 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
-context "ONIX::Normaliser", "with a utf8 file that has illegal control chars" do
+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"
@@ -35,10 +58,10 @@
after(:each) do
File.unlink(@outfile) if File.file?(@outfile)
end
- specify "should remove all control chars except LF, CR and TAB" do
+ 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)