Sha256: f0e57f09d3413e6216c9e3122e146bd01df63dc160d669fb813f1d4d516ef9e4

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

# coding: utf-8

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

context "ONIX::SenderIdentifier" do

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

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

  specify "should provide read access to first level attributes" do
    id = ONIX::SenderIdentifier.from_xml(@root.to_s)

    id.sender_id_type.should eql(1)
    id.id_value.should eql("123456")
  end

  specify "should provide write access to first level attributes" do
    id = ONIX::SenderIdentifier.new

    id.sender_id_type = 1
    id.to_xml.to_s.include?("<SenderIDType>01</SenderIDType>").should be_true

    id.id_value = "54321"
    id.to_xml.to_s.include?("<IDValue>54321</IDValue>").should be_true

  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
onix-0.8.4 spec/sender_identifier.rb
milkfarm-onix-0.8.6 spec/sender_identifier.rb
milkfarm-onix-0.8.5 spec/sender_identifier.rb