Sha256: 8e2e7afcec716a0d13739f1f281505121e7bf857b66110489d3367fb9e8c3a35
Contents?: true
Size: 1.02 KB
Versions: 14
Compression:
Stored size: 1.02 KB
Contents
# coding: utf-8 require File.dirname(__FILE__) + '/spec_helper.rb' describe 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 it "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 it "should provide read access to first level attributes" do series = ONIX::SeriesIdentifier.from_xml(@root.to_s) series.series_id_type.should eql(1) series.id_value.should eql("10001") end it "should provide write access to first level attributes" 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
14 entries across 14 versions & 2 rubygems