Sha256: 9ab24d3591cd13c42d9290cf24b809f2b8f360322be9a02bda32e96f31e55f33

Contents?: true

Size: 881 Bytes

Versions: 4

Compression:

Stored size: 881 Bytes

Contents

# coding: utf-8

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

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

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

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

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

4 entries across 4 versions & 1 rubygems

Version Path
milkfarm-onix-0.8.8 spec/set_spec.rb
milkfarm-onix-0.8.7 spec/set_spec.rb
milkfarm-onix-0.8.6 spec/set_spec.rb
milkfarm-onix-0.8.5 spec/set_spec.rb