Skip to content
This repository was archived by the owner on Sep 19, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions spec/models/spree/customer_return_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
let(:return_item) { build(:return_item, inventory_unit: inventory_unit) }
let(:shipwire_id) { shipped_order_single_return_item }
let(:return_items) { [return_item] }
let(:items_array) { [{ sku: variant_1.sku, quantity: 1 }] }

before do
customer_return.return_items = return_items
Expand All @@ -87,6 +88,10 @@
customer_return.save
expect(customer_return.shipwire_id).not_to be nil
end

it 'places a single item in the return' do
expect(customer_return.to_shipwire[:items]).to eq items_array
end
end

context 'when return has multiple return items',
Expand All @@ -100,6 +105,7 @@
let(:return_item_3) { build(:return_item, inventory_unit: inventory_unit_2) }
let(:shipwire_id) { shipped_order_multiple_return_items }
let(:return_items) { [return_item_1, return_item_2, return_item_3] }
let(:items_array) { [{ sku: variant_1.sku, quantity: 1 }, { sku: variant_2.sku, quantity: 2 }] }

before do
customer_return.return_items = return_items
Expand All @@ -111,6 +117,10 @@
customer_return.save
expect(customer_return.shipwire_id).not_to be nil
end

it 'places multiple items in the return' do
expect(customer_return.to_shipwire[:items]).to eq items_array
end
end
end

Expand Down