Sha256: 06e4202a7b77cbc4d7be11af0db3d0eb839bb4208b37b011275be88ac029c079

Contents?: true

Size: 992 Bytes

Versions: 14

Compression:

Stored size: 992 Bytes

Contents

# coding: utf-8

require File.dirname(__FILE__) + '/spec_helper.rb'

describe ONIX::Imprint do

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

  it "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

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

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

  it "should provide write access to first level attributes" 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

14 entries across 14 versions & 2 rubygems

Version Path
onix-0.9.5 spec/imprint_spec.rb
onix-0.9.4 spec/imprint_spec.rb
milkfarm-onix-0.8.13 spec/imprint_spec.rb
milkfarm-onix-0.8.12 spec/imprint_spec.rb
onix-0.9.3 spec/imprint_spec.rb
onix-0.9.2 spec/imprint_spec.rb
onix-0.9.1 spec/imprint_spec.rb
milkfarm-onix-0.8.11 spec/imprint_spec.rb
milkfarm-onix-0.8.10 spec/imprint_spec.rb
onix-0.9.0 spec/imprint_spec.rb
milkfarm-onix-0.8.9 spec/imprint_spec.rb
milkfarm-onix-0.8.8 spec/imprint_spec.rb
milkfarm-onix-0.8.7 spec/imprint_spec.rb
onix-0.8.5 spec/imprint_spec.rb