Sha256: b531dbb737e3cd0c287a5689d297d8546aabf82d2362fdfd4d862ca55d04c58c

Contents?: true

Size: 784 Bytes

Versions: 4

Compression:

Stored size: 784 Bytes

Contents

require "spec_helper"

module ShipCompliant
  describe ProductAttributes do

    context "to_h" do
      it "converts keys to pascal case" do
        product = ProductAttributes.new(unit_price: 10)
        product.to_h.should == {
          "UnitPrice" => 10
        }
      end

      it "handles special cases" do
        product = ProductAttributes.new(
          bottle_size_ml: 'value',
          gtin: 'value',
          nabca: 'value',
          scc: 'value',
          unimerc: 'value',
          upc: 'value'
        )

        product.to_h.should == {
          'BottleSizeML' => 'value',
          'GTIN' => 'value',
          'NABCA' => 'value',
          'SCC' => 'value',
          'UNIMERC' => 'value',
          'UPC' => 'value'
        }
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ship_compliant-0.2.0 spec/lib/ship_compliant/product_attributes_spec.rb
ship_compliant-0.1.2 spec/lib/ship_compliant/product_attributes_spec.rb
ship_compliant-0.1.1 spec/lib/ship_compliant/product_attributes_spec.rb
ship_compliant-0.1.0 spec/lib/ship_compliant/product_attributes_spec.rb