Sha256: de014f1ec91206ea881318ef4a60aff1f38e36b315c087484dbafc19f3926c16

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

require 'spec_helper'

module Spree
  describe Order do
    let(:user) { stub_model(LegacyUser) }

    it 'can build an order from API parameters' do
      product = Spree::Product.create!(:name => 'Test', :sku => 'TEST-1', :price => 33.22)
      variant_id = product.master.id
      order = Order.build_from_api(user, { :line_items_attributes => { "0" => { :variant_id => variant_id, :quantity => 5 }}})

      order.user.should == nil
      line_item = order.line_items.first
      line_item.quantity.should == 5
      line_item.variant_id.should == variant_id
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_api-1.3.3 spec/models/spree/order_spec.rb