Sha256: a8e7d18e216010becf82eafa46b9f9fd4524b9f6dabc134bd2802e8fbe90de86

Contents?: true

Size: 1.03 KB

Versions: 13

Compression:

Stored size: 1.03 KB

Contents

# coding: utf-8

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')

require 'onix'

context "ONIX::Publisher" do

  before(:each) do
    data_path = File.join(File.dirname(__FILE__),"..","data")
    file1    = File.join(data_path, "publisher.xml")
    @doc = LibXML::XML::Document.file(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 attibutes" 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 attibutes" 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

13 entries across 13 versions & 2 rubygems

Version Path
milkfarm-onix-0.7.7 spec/publisher_spec.rb
onix-0.7.8 spec/publisher_spec.rb
onix-0.7.7 spec/publisher_spec.rb
onix-0.7.6 spec/publisher_spec.rb
onix-0.7.5 spec/publisher_spec.rb
onix-0.7.4 spec/publisher_spec.rb
onix-0.7.2 spec/publisher_spec.rb
onix-0.7.3 spec/publisher_spec.rb
onix-0.7.0 spec/publisher_spec.rb
onix-0.7.1 spec/publisher_spec.rb
onix-0.5.0 spec/publisher_spec.rb
onix-0.6.0 spec/publisher_spec.rb
onix-0.5.1 spec/publisher_spec.rb