Sha256: 936bf292c0f497015e26b4b2b30b6394a757339a272a51c4516c16cea28d909d

Contents?: true

Size: 929 Bytes

Versions: 3

Compression:

Stored size: 929 Bytes

Contents

# coding: utf-8

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

context "ONIX::SalesRestriction" do

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

  specify "should correctly convert to a string" do
    sr = ONIX::SalesRestriction.from_xml(@root.to_s)
    sr.to_xml.to_s[0,18].should eql("<SalesRestriction>")
  end

  specify "should provide read access to first level attributes" do
    sr = ONIX::SalesRestriction.from_xml(@root.to_s)

    sr.sales_restriction_type.should eql(0)
  end

  specify "should provide write access to first level attributes" do
    sr = ONIX::SalesRestriction.new

    sr.sales_restriction_type = 1
    sr.to_xml.to_s.include?("<SalesRestrictionType>01</SalesRestrictionType>").should be_true
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
onix-0.8.4 spec/sales_restriction_spec.rb
milkfarm-onix-0.8.6 spec/sales_restriction_spec.rb
milkfarm-onix-0.8.5 spec/sales_restriction_spec.rb