Sha256: 23095f59e24878c70431763295e9cdbc71c09ac95792bdff82e2726df987decd

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'
describe Seko::Order do

  let(:email) { "stephen.jones@gmail.com" }

  before do
    Seko.configure(configuration)
  end

  describe '.websubmit' do
    it 'returns a JSON order object for a web order' do
      expected_result = fixture(:order_websubmit)
      expect(Seko::Order.websubmit(order_hash)).to eq(expected_result)
    end
  end

  describe '.submit' do
    it 'returns a JSON order object for a retailer' do
      expected_result = fixture(:order_submit)
      expect(Seko::Order.submit(company_order_hash)).to eq(expected_result)
    end
  end

  describe '.format' do

    it 'returns a Seko ready JSON order object' do
      expected_result = fixture(:order_websubmit)
      expect(Seko::Order.format(order_hash, 'Web')).to eq(expected_result)
    end

  end

  describe '.address' do

    it 'returns JSON format ready address' do
      expected_result = fixture(:order_websubmit)["Request"]["DeliveryDetails"]
      expect(Seko::Order.address(address_hash, email)).to eq(expected_result)
    end

  end

  describe '.line_items' do

    it 'returns JSON format ready line items array' do
      expected_result = fixture(:order_websubmit)["Request"]["List"]["SalesOrderLineItem"]
      expect(Seko::Order.line_items(line_items_array)).to eq(expected_result)
    end

  end

  describe '.company' do

    it 'returns JSON format ready company' do
      expected_result = { "ShipToCompany" => fixture(:order_submit)["Request"]["ShipToCompany"] }
      expect(Seko::Order.company(company_hash)).to eq(expected_result)
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
seko-0.0.4 spec/lib/order_spec.rb
seko-0.0.3 spec/lib/order_spec.rb
seko-0.0.2 spec/lib/order_spec.rb
seko-0.0.1 spec/lib/order_spec.rb