Sha256: 6ddc0dd394bcc5e6f0a83a8c8604444e180bc7d332dba26233d3710bfe38fef0

Contents?: true

Size: 963 Bytes

Versions: 1

Compression:

Stored size: 963 Bytes

Contents

# coding: utf-8

require 'spec_helper'

describe ONIX2::Publisher do

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

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

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

    Then { pub.publishing_role == 1 }
    Then { pub.publisher_name == "Desbooks Publishing" }
  end

  context "should provide write access to first level attributes" do
    Given(:pub) { ONIX2::Publisher.new }
    describe :publisher_name= do
      When { pub.publisher_name = "Paulist Press" }
      Then { pub.to_xml.to_s.include? "<PublisherName>Paulist Press</PublisherName>" }
    end
    describe :publishing_role= do
      When { pub.publishing_role = 2 }
      Then { pub.to_xml.to_s.include? "<PublishingRole>02</PublishingRole>" }
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onix2-1.0.0 spec/publisher_spec.rb