Sha256: c4287a13eaf170e1db9e683813976bbeadf74acf8e1cda7521afb2cd2f9ad137

Contents?: true

Size: 1006 Bytes

Versions: 5

Compression:

Stored size: 1006 Bytes

Contents

# coding: utf-8

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

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

  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

5 entries across 5 versions & 2 rubygems

Version Path
onix-0.8.3 spec/imprint_spec.rb
milkfarm-onix-0.8.3 spec/imprint_spec.rb
onix-0.8.2 spec/imprint_spec.rb
onix-0.8.1 spec/imprint_spec.rb
onix-0.8.0 spec/imprint_spec.rb