Sha256: 816e8b5a7d02bb346fde69c16ad5b2304bac5b0b6a14c53dc911537ff39e5a37

Contents?: true

Size: 930 Bytes

Versions: 5

Compression:

Stored size: 930 Bytes

Contents

# coding: utf-8

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

context "ONIX::Series" do

  before(:each) do
    data_path = File.join(File.dirname(__FILE__),"..","data")
    file1    = File.join(data_path, "series.xml")
    @doc = Nokogiri::XML::Document.parse(File.read(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

5 entries across 5 versions & 2 rubygems

Version Path
onix-0.8.3 spec/series_spec.rb
milkfarm-onix-0.8.3 spec/series_spec.rb
onix-0.8.2 spec/series_spec.rb
onix-0.8.1 spec/series_spec.rb
onix-0.8.0 spec/series_spec.rb