Sha256: 974a922b6c39e636bf4c7a0eb444fed0e34e79a5e6eaf9958f1db169f54cfac1
Contents?: true
Size: 1.88 KB
Versions: 4
Compression:
Stored size: 1.88 KB
Contents
require 'spec_helper' describe Spree::Order do context '#finalize_with_drop_ship!' do after do SpreeDropShip::Config[:send_supplier_email] = true end it 'should deliver drop ship orders when Spree::DropShipConfig[:send_supplier_email] == true' do order = create(:order_with_totals, ship_address: create(:address)) order.line_items = [create(:line_item, variant: create(:variant_with_supplier)), create(:line_item, variant: create(:variant_with_supplier))] order.create_proposed_shipments order.shipments.each do |shipment| Spree::DropShipOrderMailer.should_receive(:supplier_order).with(shipment.id).and_return(double(Mail, :deliver! => true)) end order.finalize! order.reload # Check orders are properly split. order.shipments.size.should eql(2) order.shipments.each do |shipment| shipment.line_items.size.should eql(1) shipment.line_items.first.variant.suppliers.first.should eql(shipment.supplier) end end it 'should NOT deliver drop ship orders when Spree::DropShipConfig[:send_supplier_email] == false' do SpreeDropShip::Config[:send_supplier_email] = false order = create(:order_with_totals, ship_address: create(:address)) order.line_items = [create(:line_item, variant: create(:variant_with_supplier)), create(:line_item, variant: create(:variant_with_supplier))] order.create_proposed_shipments order.shipments.each do |shipment| Spree::DropShipOrderMailer.should_not_receive(:supplier_order).with(shipment.id) end order.finalize! order.reload # Check orders are properly split. order.shipments.size.should eql(2) order.shipments.each do |shipment| shipment.line_items.size.should eql(1) shipment.line_items.first.variant.suppliers.first.should eql(shipment.supplier) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems