Sha256: f4ab8cda10cc4305fa44f98b35490370782380f593960e223768902e9523be1a

Contents?: true

Size: 979 Bytes

Versions: 14

Compression:

Stored size: 979 Bytes

Contents

# coding: utf-8

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

describe ONIX::OtherText do

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

  it "should correctly convert to a string" do
    ot = ONIX::OtherText.from_xml(@root.to_s)
    ot.to_xml.to_s[0,11].should eql("<OtherText>")
  end

  it "should provide read access to first level attributes" do
    ot = ONIX::OtherText.from_xml(@root.to_s)

    ot.text_type_code.should eql(2)
    ot.text[0,7].should eql("A woman")
  end

  it "should provide write access to first level attributes" do
    ot = ONIX::OtherText.new

    ot.text_type_code = 2
    ot.to_xml.to_s.include?("<TextTypeCode>02</TextTypeCode>").should be_true

    ot.text = "James Healy"
    ot.to_xml.to_s.include?("<Text>James Healy</Text>").should be_true

  end

end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
onix-0.9.5 spec/other_text_spec.rb
onix-0.9.4 spec/other_text_spec.rb
milkfarm-onix-0.8.13 spec/other_text_spec.rb
milkfarm-onix-0.8.12 spec/other_text_spec.rb
onix-0.9.3 spec/other_text_spec.rb
onix-0.9.2 spec/other_text_spec.rb
onix-0.9.1 spec/other_text_spec.rb
milkfarm-onix-0.8.11 spec/other_text_spec.rb
milkfarm-onix-0.8.10 spec/other_text_spec.rb
onix-0.9.0 spec/other_text_spec.rb
milkfarm-onix-0.8.9 spec/other_text_spec.rb
milkfarm-onix-0.8.8 spec/other_text_spec.rb
milkfarm-onix-0.8.7 spec/other_text_spec.rb
onix-0.8.5 spec/other_text_spec.rb