Sha256: 70f8734ceaac3f5d2929cd32b422e1948895717cf8f9ae8c75821ebc65f95a8b
Contents?: true
Size: 1.08 KB
Versions: 13
Compression:
Stored size: 1.08 KB
Contents
# coding: utf-8 $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') require 'onix' context "ONIX::MarketRepresentation" do before(:each) do data_path = File.join(File.dirname(__FILE__),"..","data") file1 = File.join(data_path, "market_representation.xml") @doc = LibXML::XML::Document.file(file1) @root = @doc.root end specify "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 specify "should provide read access to first level attibutes" do rep = ONIX::MarketRepresentation.from_xml(@root.to_s) rep.agent_name.should eql("Allen & Unwin") rep.agent_role.should eql(7) end specify "should provide write access to first level attibutes" 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
13 entries across 13 versions & 2 rubygems