Sha256: b57f03584c7bb18b9f2d676cbe7a6f6b6757e9278ef85e31001aa896d3c255e5
Contents?: true
Size: 998 Bytes
Versions: 5
Compression:
Stored size: 998 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 attibutes" 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 attibutes" 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
5 entries across 5 versions & 2 rubygems
Version | Path |
---|---|
onix-0.8.3 | spec/price_spec.rb |
milkfarm-onix-0.8.3 | spec/price_spec.rb |
onix-0.8.2 | spec/price_spec.rb |
onix-0.8.1 | spec/price_spec.rb |
onix-0.8.0 | spec/price_spec.rb |