Sha256: 222646ac269036fc0eec69be3c7cea12639a7b9a25935bb794be56fffa27c2f1

Contents?: true

Size: 1.01 KB

Versions: 13

Compression:

Stored size: 1.01 KB

Contents

# coding: utf-8

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')

require 'onix'

context "ONIX::SenderIdentifier" do

  before(:each) do
    data_path = File.join(File.dirname(__FILE__),"..","data")
    file1    = File.join(data_path, "sender_identifier.xml")
    @doc = LibXML::XML::Document.file(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 attibutes" 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 attibutes" 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

13 entries across 13 versions & 2 rubygems

Version Path
milkfarm-onix-0.7.7 spec/sender_identifier.rb
onix-0.7.8 spec/sender_identifier.rb
onix-0.7.7 spec/sender_identifier.rb
onix-0.7.6 spec/sender_identifier.rb
onix-0.7.5 spec/sender_identifier.rb
onix-0.7.4 spec/sender_identifier.rb
onix-0.7.2 spec/sender_identifier.rb
onix-0.7.3 spec/sender_identifier.rb
onix-0.7.0 spec/sender_identifier.rb
onix-0.7.1 spec/sender_identifier.rb
onix-0.5.0 spec/sender_identifier.rb
onix-0.6.0 spec/sender_identifier.rb
onix-0.5.1 spec/sender_identifier.rb