Sha256: 875f79ebcd2d4fdccd28382eda20c2a01e74208f91296c2cc73b3039aca6ce0d
Contents?: true
Size: 1.55 KB
Versions: 3
Compression:
Stored size: 1.55 KB
Contents
# coding: utf-8 require File.dirname(__FILE__) + '/spec_helper.rb' context "ONIX::SupplyDetail" do before(:each) do data_path = File.join(File.dirname(__FILE__),"..","data") file1 = File.join(data_path, "supply_detail.xml") @doc = Nokogiri::XML::Document.parse(File.read(file1)) @root = @doc.root end specify "should correctly convert to a string" do sd = ONIX::SupplyDetail.from_xml(@root.to_s) sd.to_xml.to_s[0,14].should eql("<SupplyDetail>") end specify "should provide read access to first level attributes" do sd = ONIX::SupplyDetail.from_xml(@root.to_s) sd.supplier_name.should eql("Rainbow Book Agencies") sd.product_availability.should eql(21) sd.stock.should be_a_kind_of(Array) sd.stock.size.should eql(1) sd.pack_quantity.should eql(16) sd.prices.should be_a_kind_of(Array) sd.prices.size.should eql(1) end specify "should provide write access to first level attributes" do sd = ONIX::SupplyDetail.new sd.supplier_name = "RBA" sd.to_xml.to_s.include?("<SupplierName>RBA</SupplierName>").should be_true sd.supplier_role = 1 sd.to_xml.to_s.include?("<SupplierRole>01</SupplierRole>").should be_true sd.availability_status_code = 2 sd.to_xml.to_s.include?("<AvailabilityStatusCode>02</AvailabilityStatusCode>").should be_true sd.product_availability = 3 sd.to_xml.to_s.include?("<ProductAvailability>03</ProductAvailability>").should be_true sd.pack_quantity = 12 sd.to_xml.to_s.include?("<PackQuantity>12</PackQuantity>").should be_true end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
onix-0.8.4 | spec/supply_detail_spec.rb |
milkfarm-onix-0.8.6 | spec/supply_detail_spec.rb |
milkfarm-onix-0.8.5 | spec/supply_detail_spec.rb |