Sha256: 39f7e185d32c8065099d57de17b8268db3bbb1aa58694951e8e7adfb0959614c

Contents?: true

Size: 995 Bytes

Versions: 13

Compression:

Stored size: 995 Bytes

Contents

# coding: utf-8

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

require 'onix'

context "ONIX::OtherText" do

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

  specify "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

  specify "should provide read access to first level attibutes" 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

  specify "should provide write access to first level attibutes" 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

13 entries across 13 versions & 2 rubygems

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