Sha256: a50c32d0769fbe910faacdb9fbe4d0eb7691a3fe69c1e20de97bba61e2da3ffb

Contents?: true

Size: 865 Bytes

Versions: 5

Compression:

Stored size: 865 Bytes

Contents

# coding: utf-8

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

describe ONIX::Set do

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

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

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

    set.title_of_set.should eql("Citizens and Their Governments")
  end

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

    set.title_of_set = "Cool Science Careers"
    set.to_xml.to_s.include?("<TitleOfSet>Cool Science Careers</TitleOfSet>").should be_true
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
milkfarm-onix-0.8.13 spec/set_spec.rb
milkfarm-onix-0.8.12 spec/set_spec.rb
milkfarm-onix-0.8.11 spec/set_spec.rb
milkfarm-onix-0.8.10 spec/set_spec.rb
milkfarm-onix-0.8.9 spec/set_spec.rb