Sha256: 57466e403849d65795699fb320fbd36592796b1c3adbc806d1d20f6111487f06

Contents?: true

Size: 944 Bytes

Versions: 1

Compression:

Stored size: 944 Bytes

Contents

# coding: utf-8

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

require 'onix'

context "ONIX::Series" do

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

  specify "should correctly convert to a string" do
    series = ONIX::Series.from_xml(@root.to_s)
    series.to_xml.to_s[0,8].should eql("<Series>")
  end

  specify "should provide read access to first level attibutes" do
    series = ONIX::Series.from_xml(@root.to_s)
    
    series.title_of_series.should eql("Citizens and Their Governments")
  end

  specify "should provide write access to first level attibutes" do
    series = ONIX::Series.new
    
    series.title_of_series = "Cool Science Careers"
    series.to_xml.to_s.include?("<TitleOfSeries>Cool Science Careers</TitleOfSeries>").should be_true
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
milkfarm-onix-0.7.7 spec/series_spec.rb