Sha256: 7b57962fd9b0c2aecf478a095a0235817d0908752ad2c9506d3dfb96273b746d

Contents?: true

Size: 929 Bytes

Versions: 13

Compression:

Stored size: 929 Bytes

Contents

# coding: utf-8

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')

require 'onix'

context "ONIX::SalesRestriction" do

  before(:each) do
    data_path = File.join(File.dirname(__FILE__),"..","data")
    file1    = File.join(data_path, "sales_restriction.xml")
    @doc = LibXML::XML::Document.file(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 attibutes" 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 attibutes" 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

13 entries across 13 versions & 2 rubygems

Version Path
milkfarm-onix-0.7.7 spec/sales_restriction_spec.rb
onix-0.7.8 spec/sales_restriction_spec.rb
onix-0.7.7 spec/sales_restriction_spec.rb
onix-0.7.6 spec/sales_restriction_spec.rb
onix-0.7.5 spec/sales_restriction_spec.rb
onix-0.7.4 spec/sales_restriction_spec.rb
onix-0.7.2 spec/sales_restriction_spec.rb
onix-0.7.3 spec/sales_restriction_spec.rb
onix-0.7.0 spec/sales_restriction_spec.rb
onix-0.7.1 spec/sales_restriction_spec.rb
onix-0.5.0 spec/sales_restriction_spec.rb
onix-0.6.0 spec/sales_restriction_spec.rb
onix-0.5.1 spec/sales_restriction_spec.rb