Sha256: 02b9d4eefb6827e2d468276e11a230c47c93e5f52448e64dcc669a6bf879c7b2

Contents?: true

Size: 914 Bytes

Versions: 14

Compression:

Stored size: 914 Bytes

Contents

# coding: utf-8

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

describe "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

  it "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

  it "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

  it "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

14 entries across 14 versions & 2 rubygems

Version Path
onix-0.9.5 spec/sales_restriction_spec.rb
onix-0.9.4 spec/sales_restriction_spec.rb
milkfarm-onix-0.8.13 spec/sales_restriction_spec.rb
milkfarm-onix-0.8.12 spec/sales_restriction_spec.rb
onix-0.9.3 spec/sales_restriction_spec.rb
onix-0.9.2 spec/sales_restriction_spec.rb
onix-0.9.1 spec/sales_restriction_spec.rb
milkfarm-onix-0.8.11 spec/sales_restriction_spec.rb
milkfarm-onix-0.8.10 spec/sales_restriction_spec.rb
onix-0.9.0 spec/sales_restriction_spec.rb
milkfarm-onix-0.8.9 spec/sales_restriction_spec.rb
milkfarm-onix-0.8.8 spec/sales_restriction_spec.rb
milkfarm-onix-0.8.7 spec/sales_restriction_spec.rb
onix-0.8.5 spec/sales_restriction_spec.rb