Sha256: 3d524de6b8706a2e7f0ee17432c480ad50a743f3d957398139b762642b5c8f4a

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 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)
        expect(product.to_h).to eq({
          "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'
        )

        expect(product.to_h).to eq({
          'BottleSizeML' => 'value',
          'GTIN' => 'value',
          'NABCA' => 'value',
          'SCC' => 'value',
          'UNIMERC' => 'value',
          'UPC' => 'value'
        })
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ship_compliant-0.2.1 spec/lib/ship_compliant/product_attributes_spec.rb