Sha256: 2addf6ea755ce591b8c0c90ae7e7b174fdb11042ce819581974a3f955e769c4b

Contents?: true

Size: 930 Bytes

Versions: 1

Compression:

Stored size: 930 Bytes

Contents

# coding: utf-8

require 'spec_helper'

describe ONIX2::SenderIdentifier do

  Given(:doc) { load_xml "sender_identifier.xml" }

  describe "should correctly convert to a string" do
    Given(:id) { ONIX2::SenderIdentifier.from_xml(doc) }
    Then { id.to_xml.to_s.start_with? "<SenderIdentifier>" }
  end

  describe "should provide read access to first level attributes" do
    Given(:id) { ONIX2::SenderIdentifier.from_xml(doc) }

    Then { id.sender_id_type == 1 }
    Then { id.id_value == "123456" }
  end

  context "should provide write access to first level attributes" do
    Given(:id) { ONIX2::SenderIdentifier.new }
    describe :sender_id_type= do
      When { id.sender_id_type = 1 }
      Then { id.to_xml.to_s.include? "<SenderIDType>01</SenderIDType>" }
    end
    describe :id_value= do
      When { id.id_value = "54321" }
      Then { id.to_xml.to_s.include? "<IDValue>54321</IDValue>" }
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onix2-1.0.0 spec/sender_identifier.rb