Sha256: 41c91e1f3c61cfd3a9ae92d8bbd9dc5b68e68ed892a1a109bcb2f041a0383018

Contents?: true

Size: 1002 Bytes

Versions: 13

Compression:

Stored size: 1002 Bytes

Contents

# coding: utf-8

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

require 'onix'

context "ONIX::Imprint" do

  before(:each) do
    data_path = File.join(File.dirname(__FILE__),"..","data")
    file1    = File.join(data_path, "imprint.xml")
    @doc = LibXML::XML::Document.file(file1)
    @root = @doc.root
  end

  specify "should correctly convert to a string" do
    imp = ONIX::Imprint.from_xml(@root.to_s)
    imp.to_xml.to_s[0,9].should eql("<Imprint>")
  end

  specify "should provide read access to first level attibutes" do
    imp = ONIX::Imprint.from_xml(@root.to_s)

    imp.imprint_name.should eql("Oxford University Press UK")
  end

  specify "should provide write access to first level attibutes" do
    imp = ONIX::Imprint.new

    imp.imprint_name = "Paulist Press"
    imp.to_xml.to_s.include?("<ImprintName>Paulist Press</ImprintName>").should be_true

    imp.name_code_type = 1
    imp.to_xml.to_s.include?("<NameCodeType>01</NameCodeType>").should be_true

  end

end

Version data entries

13 entries across 13 versions & 2 rubygems

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