Sha256: fb4b38ad7fa29fa09a39233a95297a5678fc3ae4718d569e2fd7469cc4d71e6b

Contents?: true

Size: 1.53 KB

Versions: 7

Compression:

Stored size: 1.53 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(order_hash)).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

7 entries across 7 versions & 1 rubygems

Version Path
seko-0.0.11 spec/lib/order_spec.rb
seko-0.0.10 spec/lib/order_spec.rb
seko-0.0.9 spec/lib/order_spec.rb
seko-0.0.8 spec/lib/order_spec.rb
seko-0.0.7 spec/lib/order_spec.rb
seko-0.0.6 spec/lib/order_spec.rb
seko-0.0.5 spec/lib/order_spec.rb