Sha256: 6ea0cf16a1b036c4d619068ca8f4275a8e0d92277c11ccc7a368fc1ef7678387

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe Bling::API::Product do

  describe 'parsed hash' do
    it 'correctly parses it to template' do
      params = {
        code: '92314',
        description: 'Awesome product',
        additional_description: 'In lovely colors',
        unit: 'Pc',
        price: 20.50,
        cost_price: 14.30,
        raw_weight: 2,
        weight: 1.8,
        tax_category: '1000.01.01',
        origin: 0,
        quantity: 10,
        gtin: 832222,
        gtin_package: 13414,
        width: 25,
        height: 15,
        depth: 10,
        min_quantity: 1,
        max_quantity: 200,
        cest: ''
      }
      product = Bling::API::Product.new
      product.instance_variable_set(:@params, params)

      parsed_params = product.send :parsed_xml
      expect(parsed_params).to match(/Awesome/)
    end


    it 'works with the min required params' do
      params = {
        description: 'Awesome product',
        price: 20.50,
      }

      product = Bling::API::Product.new
      product.instance_variable_set(:@params, params)

      parsed_params = product.send :parsed_xml
      expect(parsed_params).to match(/20.5/)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bling-ruby-api-0.0.1 spec/lib/bling/api/product_spec.rb