Sha256: b01b7ec143d6fb7d5805bd9b6a6e2b83c0750013b3f06b82cd7106dd12520d80

Contents?: true

Size: 1.01 KB

Versions: 14

Compression:

Stored size: 1.01 KB

Contents

# coding: utf-8

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

describe ONIX::Website do

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

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

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

    web.website_role.should eql(1)
    web.website_link.should eql("http://www.rainbowbooks.com.au")
  end

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

    web.website_role = 2
    web.to_xml.to_s.include?("<WebsiteRole>02</WebsiteRole>").should be_true

    web.website_link = "http://www.yob.id.au"
    web.to_xml.to_s.include?("<WebsiteLink>http://www.yob.id.au</WebsiteLink>").should be_true

  end

end


Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
onix-0.9.5 spec/website_spec.rb
onix-0.9.4 spec/website_spec.rb
milkfarm-onix-0.8.13 spec/website_spec.rb
milkfarm-onix-0.8.12 spec/website_spec.rb
onix-0.9.3 spec/website_spec.rb
onix-0.9.2 spec/website_spec.rb
onix-0.9.1 spec/website_spec.rb
milkfarm-onix-0.8.11 spec/website_spec.rb
milkfarm-onix-0.8.10 spec/website_spec.rb
onix-0.9.0 spec/website_spec.rb
milkfarm-onix-0.8.9 spec/website_spec.rb
milkfarm-onix-0.8.8 spec/website_spec.rb
milkfarm-onix-0.8.7 spec/website_spec.rb
onix-0.8.5 spec/website_spec.rb