Sha256: 49f06c49fb1e5c8bcc297c6ce955fe7570dd4ee5fcc85ddd1898ab2e68a347d9

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

# coding: utf-8

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

context "ONIX::SeriesIdentifier" do

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

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

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

    series.series_id_type.should eql(1)
    series.id_value.should eql("10001")
  end

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

    series.series_id_type = 9
    series.to_xml.to_s.include?("<SeriesIDType>09</SeriesIDType>").should be_true

    series.id_value = 999
    series.to_xml.to_s.include?("<IDValue>999</IDValue>").should be_true
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

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