Sha256: 3722be9555817642a6326423a7ca03a2ccaa54fd525b34eb9c6f641a7bdc98c9

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

# coding: utf-8

require 'spec_helper'

describe "ONIX2::SalesRestriction" do

  Given(:doc) { load_xml "sales_restriction.xml" }

  describe "should correctly convert to a string" do
    Given(:sr) { ONIX2::SalesRestriction.from_xml(doc) }
    Then { sr.to_xml.to_s.start_with? "<SalesRestriction>" }
  end

  describe "should provide read access to first level attributes" do
    Given(:sr) { ONIX2::SalesRestriction.from_xml(doc) }
    Then { sr.sales_restriction_type == 0 }
  end

  context "should provide write access to first level attributes" do
    Given(:sr) { ONIX2::SalesRestriction.new }
    describe :sales_restriction_type= do
      When { sr.sales_restriction_type = 1 }
      Then { sr.to_xml.to_s.include? "<SalesRestrictionType>01</SalesRestrictionType>" }
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onix2-1.0.0 spec/sales_restriction_spec.rb