Sha256: e05735cbb6ad7a74ce91f9a0efa4c41f35b74eb4f4122d837c7ba46748d6e2ec

Contents?: true

Size: 995 Bytes

Versions: 1

Compression:

Stored size: 995 Bytes

Contents

# coding: utf-8

require 'spec_helper'

describe ONIX2::MarketRepresentation do

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

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

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

    Then { rep.agent_name == "Allen & Unwin" }
    Then { rep.agent_role == 7 }
  end

  context "should provide write access to first level attributes" do
    Given(:rep) { ONIX2::MarketRepresentation.new }
    describe :agent_name= do
      When { rep.agent_name = "Rainbow Book Agencies" }
      Then { rep.to_xml.to_s.include? "<AgentName>Rainbow Book Agencies</AgentName>" }
    end
    describe :agent_role= do
      When { rep.agent_role = 3 }
      Then { rep.to_xml.to_s.include? "<AgentRole>03</AgentRole>" }
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onix2-1.0.0 spec/market_representation_spec.rb