Sha256: 9b9713fccb04e4082ea83de7794142e62f38f4c50304de84e72d95597dfe2601
Contents?: true
Size: 1000 Bytes
Versions: 3
Compression:
Stored size: 1000 Bytes
Contents
# coding: utf-8 require File.dirname(__FILE__) + '/spec_helper.rb' context "ONIX::Price" do before(:each) do data_path = File.join(File.dirname(__FILE__),"..","data") file1 = File.join(data_path, "price.xml") @doc = Nokogiri::XML::Document.parse(File.read(file1)) @root = @doc.root end specify "should correctly convert to a string" do p = ONIX::Price.from_xml(@root.to_s) p.to_xml.to_s[0,7].should eql("<Price>") end specify "should provide read access to first level attributes" do p = ONIX::Price.from_xml(@root.to_s) p.price_type_code.should eql(2) p.price_amount.should eql(BigDecimal.new("7.5")) end specify "should provide write access to first level attributes" do p = ONIX::Price.new p.price_type_code = 1 p.to_xml.to_s.include?("<PriceTypeCode>01</PriceTypeCode>").should be_true p.price_amount = BigDecimal.new("7.5") p.to_xml.to_s.include?("<PriceAmount>7.5</PriceAmount>").should be_true end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
onix-0.8.4 | spec/price_spec.rb |
milkfarm-onix-0.8.6 | spec/price_spec.rb |
milkfarm-onix-0.8.5 | spec/price_spec.rb |