solidus_core 2.8.0 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6a0e506dd5c20cd114029a4d8f7cf6c9dff0ef0ce08c3b92cdd24e39b58f97e
|
4
|
+
data.tar.gz: 1936cc0f6fda95d9a4931b584eeec1c3529d64dec7aee80c92e0b58183d0c19b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd93440711741bf2970e57db6cc86325f0ae2faa28642651a959f40004bf9b384cd39343d23836ef6bdb5565c04aa818822b1443284c3feee93ebdc51b4b4b84
|
7
|
+
data.tar.gz: 46461444d4462294444911f9ec1a7da35e75e82a3713e62879ef7e08cc4f58cc02b01eefd2678cee624cd3158ad165a28c0ecefb9c456cf1df5167af1b812550
|
@@ -38,7 +38,7 @@ module Spree
|
|
38
38
|
inventory_units_for_shipment.group_by(&:line_item_id).each_value do |units|
|
39
39
|
shipment = units.first.shipment
|
40
40
|
line_item = units.first.line_item
|
41
|
-
shipment.stock_location.unstock line_item.variant,
|
41
|
+
shipment.stock_location.unstock line_item.variant, units.count, shipment
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
data/lib/spree/core/version.rb
CHANGED
@@ -5,29 +5,53 @@ require 'rails_helper'
|
|
5
5
|
module Spree
|
6
6
|
module Stock
|
7
7
|
RSpec.describe InventoryUnitsFinalizer, type: :model do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
before do
|
13
|
-
stock_item.set_count_on_hand(10)
|
14
|
-
stock_item.update_attributes!(backorderable: false)
|
15
|
-
inventory_unit.update_attributes!(pending: true)
|
16
|
-
end
|
8
|
+
context "when finalizing an order with one line_item" do
|
9
|
+
let(:order) { build(:order_with_line_items) }
|
10
|
+
let(:inventory_unit) { build(:inventory_unit, order: order, variant: order.line_items.first.variant, shipment: order.shipments.first) }
|
11
|
+
let(:stock_item) { inventory_unit.variant.stock_items.first }
|
17
12
|
|
18
|
-
|
13
|
+
before do
|
14
|
+
stock_item.set_count_on_hand(10)
|
15
|
+
stock_item.update_attributes!(backorderable: false)
|
16
|
+
inventory_unit.update_attributes!(pending: true)
|
17
|
+
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
subject { described_class.new([inventory_unit]).run! }
|
20
|
+
|
21
|
+
it "updates the associated inventory units" do
|
22
|
+
inventory_unit.update_columns(updated_at: 1.hour.ago)
|
23
|
+
expect { subject }.to change { inventory_unit.reload.updated_at }
|
24
|
+
end
|
25
|
+
|
26
|
+
it "updates the inventory units to not be pending" do
|
27
|
+
expect { subject }.to change { inventory_unit.reload.pending }.to(false)
|
28
|
+
end
|
24
29
|
|
25
|
-
|
26
|
-
|
30
|
+
it "unstocks the variant" do
|
31
|
+
expect { subject }.to change { stock_item.reload.count_on_hand }.from(10).to(9)
|
32
|
+
end
|
27
33
|
end
|
28
34
|
|
29
|
-
|
30
|
-
|
35
|
+
context "when finalizing an order with multiple line_items" do
|
36
|
+
let(:order) { build(:order_with_line_items, line_items_count: 2) }
|
37
|
+
let(:inventory_unit) { build(:inventory_unit, order: order, variant: order.line_items.first.variant, shipment: order.shipments.first) }
|
38
|
+
let(:inventory_unit_2) { build(:inventory_unit, order: order, variant: order.line_items.second.variant, shipment: order.shipments.first) }
|
39
|
+
let(:stock_item) { inventory_unit.variant.stock_items.first }
|
40
|
+
let(:stock_item_2) { inventory_unit.variant.stock_items.first }
|
41
|
+
|
42
|
+
before do
|
43
|
+
stock_item.set_count_on_hand(10)
|
44
|
+
stock_item_2.set_count_on_hand(10)
|
45
|
+
inventory_unit.update_attributes!(pending: true)
|
46
|
+
inventory_unit_2.update_attributes!(pending: true)
|
47
|
+
end
|
48
|
+
|
49
|
+
subject { described_class.new([inventory_unit, inventory_unit_2]).run! }
|
50
|
+
|
51
|
+
it "unstocks the variant with the correct quantity" do
|
52
|
+
expect { subject }.to change { stock_item.reload.count_on_hand }.from(10).to(9)
|
53
|
+
.and change { stock_item_2.reload.count_on_hand }.from(10).to(9)
|
54
|
+
end
|
31
55
|
end
|
32
56
|
end
|
33
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|