Sha256: 2a1a6bbfe93f7a1f4158da15278184464fba19968f2b76f1bb1217b645e9eb30
Contents?: true
Size: 1.77 KB
Versions: 8
Compression:
Stored size: 1.77 KB
Contents
# coding: utf-8 require File.dirname(__FILE__) + '/spec_helper.rb' context "ONIX::Writer" do before(:each) do @output = StringIO.new end specify "should output the correct xml metadata" do header = ONIX::Header.new writer = ONIX::Writer.new(@output, header) writer.end_document lines = @output.string.split("\n") # xml declaration lines[0][0,5].should eql("<?xml") # doctype lines[1][0,9].should eql("<!DOCTYPE") end specify "should output the correct xml metadata when used in block form" do header = ONIX::Header.new ONIX::Writer.open(@output, header) { |writer| } lines = @output.string.split("\n") # xml declaration lines[0][0,5].should eql("<?xml") # doctype lines[1][0,9].should eql("<!DOCTYPE") end specify "should output the header node" do header = ONIX::Header.new ONIX::Writer.open(@output, header) { |writer| } lines = @output.string.split("\n") lines[3][0,7].should eql("<Header") end specify "should output the product node" do header = ONIX::Header.new product = ONIX::Product.new ONIX::Writer.open(@output, header) do |writer| writer << product end lines = @output.string.split("\n") lines[4][0,8].should eql("<Product") end specify "should correctly store finished state" do header = ONIX::Header.new writer = ONIX::Writer.new(@output, header) writer.finished?.should be_false writer.end_document writer.finished?.should be_true end =begin specify "should convert non-ASCII chars to references when outputting as a string" do header = ONIX::Header.new header.from_person = "Hans Küng" ONIX::Writer.open(@output, header) { |writer| } @output.string.include?("Küng").should be_true end =end end
Version data entries
8 entries across 8 versions & 2 rubygems