Sha256: 58c849cf4febd7b718c8f33182966d45dd11f0276711a9eebee8186bb8a15d67

Contents?: true

Size: 927 Bytes

Versions: 5

Compression:

Stored size: 927 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 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

5 entries across 5 versions & 2 rubygems

Version Path
onix-0.8.3 spec/sales_restriction_spec.rb
milkfarm-onix-0.8.3 spec/sales_restriction_spec.rb
onix-0.8.2 spec/sales_restriction_spec.rb
onix-0.8.1 spec/sales_restriction_spec.rb
onix-0.8.0 spec/sales_restriction_spec.rb