Sha256: a0b6c0b31aa77b598b1dc6b4af612a93dc924ab4153e737e994de50b63f467e4
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
# coding: utf-8 require File.dirname(__FILE__) + '/spec_helper.rb' context "ONIX::Publisher" do before(:each) do data_path = File.join(File.dirname(__FILE__),"..","data") file1 = File.join(data_path, "publisher.xml") @doc = Nokogiri::XML::Document.parse(File.read(file1)) @root = @doc.root end specify "should correctly convert to a string" do pub = ONIX::Publisher.from_xml(@root.to_s) pub.to_xml.to_s[0,11].should eql("<Publisher>") end specify "should provide read access to first level attributes" do pub = ONIX::Publisher.from_xml(@root.to_s) pub.publishing_role.should eql(1) pub.publisher_name.should eql("Desbooks Publishing") end specify "should provide write access to first level attributes" do pub = ONIX::Publisher.new pub.publisher_name = "Paulist Press" pub.to_xml.to_s.include?("<PublisherName>Paulist Press</PublisherName>").should be_true pub.publishing_role = 2 pub.to_xml.to_s.include?("<PublishingRole>02</PublishingRole>").should be_true end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
onix-0.8.4 | spec/publisher_spec.rb |
milkfarm-onix-0.8.6 | spec/publisher_spec.rb |
milkfarm-onix-0.8.5 | spec/publisher_spec.rb |