Sha256: 114d14da700f9c53ceb7dd70b8fe4813495f5aabc7a0a9b530af1da6291b30e5

Contents?: true

Size: 951 Bytes

Versions: 1

Compression:

Stored size: 951 Bytes

Contents

# coding: utf-8

require 'spec_helper'

describe ONIX2::Website do

  Given(:doc) { load_xml "website.xml" }

  describe "should correctly convert to a string" do
    Given(:web) { ONIX2::Website.from_xml(doc) }
    Then { web.to_xml.to_s.start_with? "<Website>" }
  end

  describe "should provide read access to first level attributes" do
    Given(:web) { ONIX2::Website.from_xml(doc) }

    Then { web.website_role == 1 }
    Then { web.website_link == "http://www.rainbowbooks.com.au" }
  end

  context "should provide write access to first level attributes" do
    Given(:web) { ONIX2::Website.new }
    describe :website_role= do
      When { web.website_role = 2 }
      Then { web.to_xml.to_s.include? "<WebsiteRole>02</WebsiteRole>" }
    end
    describe :website_link= do
      When { web.website_link = "http://www.yob.id.au" }
      Then { web.to_xml.to_s.include? "<WebsiteLink>http://www.yob.id.au</WebsiteLink>" }
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onix2-1.0.0 spec/website_spec.rb