Sha256: f31c917fafaa5268f67dae99f155569813979fa7c949dc1c856b5f4f54246fd3

Contents?: true

Size: 1.06 KB

Versions: 14

Compression:

Stored size: 1.06 KB

Contents

# coding: utf-8

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

describe ONIX::MarketRepresentation do

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

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

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

    rep.agent_name.should eql("Allen & Unwin")
    rep.agent_role.should eql(7)
  end

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

    rep.agent_name = "Rainbow Book Agencies"
    rep.to_xml.to_s.include?("<AgentName>Rainbow Book Agencies</AgentName>").should be_true

    rep.agent_role = 3
    rep.to_xml.to_s.include?("<AgentRole>03</AgentRole>").should be_true

  end

end

Version data entries

14 entries across 14 versions & 2 rubygems

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