Sha256: bfcbeb4d7b85d1f147743a7eacaa8ce0971a7530d9bbe8f4223e77d6591c80db

Contents?: true

Size: 892 Bytes

Versions: 1

Compression:

Stored size: 892 Bytes

Contents

# coding: utf-8

require 'spec_helper'

describe ONIX2::OtherText do

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

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

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

    Then { ot.text_type_code == 2 }
    Then { ot.text.start_with? "A woman" }
  end

  context "should provide write access to first level attributes" do
    Given(:ot) { ONIX2::OtherText.new }
    describe :text_type_code= do
      When { ot.text_type_code = 2 }
      Then { ot.to_xml.to_s.include? "<TextTypeCode>02</TextTypeCode>" }
    end
    describe :text= do
      When { ot.text = "James Healy" }
      Then { ot.to_xml.to_s.include? "<Text>James Healy</Text>" }
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onix2-1.0.0 spec/other_text_spec.rb