solidus_core 2.5.0.beta2 → 2.5.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/helpers/spree/taxons_helper.rb +3 -2
- data/app/models/spree/fulfilment_changer.rb +4 -0
- data/lib/spree/core/version.rb +1 -1
- data/spec/helpers/taxons_helper_spec.rb +33 -11
- data/spec/models/spree/fulfilment_changer_spec.rb +9 -0
- data/spec/models/spree/shipment_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d3194680467637f6a7a10a8f57260d6fe8a69584e6f4694b64d4917fb1d20ea
|
4
|
+
data.tar.gz: f24092cc442961ccc16f8bcff07433d9ca52d321b0f776162f9483b9ffa09a30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c5c38ff7d7ec2a7e6acdf98fd1010af46702a3f06bedb110ef4c35c2fbce5cffbf82263a8cf66d234e88feb564eec22ed9145f0f22c8128b20a5351dd002f38
|
7
|
+
data.tar.gz: 9620c753a826613a0e21c38076e47d6e8ba1db463a55cca54d84ce19a55802711fa02ae26a29873fedbcb75de1a209565caa9c726fe844bbdb8420cdf6c5a32e
|
@@ -4,12 +4,13 @@ module Spree
|
|
4
4
|
# that we can use configurations as well as make it easier for end users to override this determination. One idea is
|
5
5
|
# to show the most popular products for a particular taxon (that is an exercise left to the developer.)
|
6
6
|
def taxon_preview(taxon, max = 4)
|
7
|
-
|
7
|
+
price_scope = Spree::Price.where(current_pricing_options.search_arguments)
|
8
|
+
products = taxon.active_products.joins(:prices).merge(price_scope).select("DISTINCT (spree_products.id), spree_products.*, spree_products_taxons.position").limit(max)
|
8
9
|
if products.size < max
|
9
10
|
products_arel = Spree::Product.arel_table
|
10
11
|
taxon.descendants.each do |descendent_taxon|
|
11
12
|
to_get = max - products.length
|
12
|
-
products += descendent_taxon.active_products.select("DISTINCT (spree_products.id), spree_products.*, spree_products_taxons.position").where(products_arel[:id].not_in(products.map(&:id))).limit(to_get)
|
13
|
+
products += descendent_taxon.active_products.joins(:prices).merge(price_scope).select("DISTINCT (spree_products.id), spree_products.*, spree_products_taxons.position").where(products_arel[:id].not_in(products.map(&:id))).limit(to_get)
|
13
14
|
break if products.size >= max
|
14
15
|
end
|
15
16
|
end
|
data/lib/spree/core/version.rb
CHANGED
@@ -1,17 +1,39 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
RSpec.describe Spree::TaxonsHelper, type: :helper do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
let(:currency) { 'USD' }
|
5
|
+
let(:pricing_options) do
|
6
|
+
Spree::Config.pricing_options_class.new(currency: currency)
|
7
|
+
end
|
8
|
+
before do
|
9
|
+
allow(helper).to receive(:current_pricing_options) { pricing_options }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#taxon_preview" do
|
13
|
+
let!(:taxon) { create(:taxon) }
|
14
|
+
let!(:child_taxon) { create(:taxon, parent: taxon) }
|
15
|
+
let!(:product_1) { create(:product) }
|
16
|
+
let!(:product_2) { create(:product) }
|
17
|
+
let!(:product_3) { create(:product) }
|
18
|
+
|
19
|
+
before do
|
20
|
+
taxon.products << product_1
|
21
|
+
taxon.products << product_2
|
22
|
+
child_taxon.products << product_3
|
23
|
+
taxon.reload
|
24
|
+
end
|
25
|
+
|
26
|
+
# Regression test for https://github.com/spree/spree/issues/4382
|
27
|
+
it "returns products" do
|
28
|
+
expect(helper.taxon_preview(taxon)).to eql([product_1, product_2, product_3])
|
29
|
+
end
|
30
|
+
|
31
|
+
context "with different currency" do
|
32
|
+
let(:currency) { 'CAD' }
|
14
33
|
|
15
|
-
|
34
|
+
it "returns no products" do
|
35
|
+
expect(helper.taxon_preview(taxon)).to be_empty
|
36
|
+
end
|
37
|
+
end
|
16
38
|
end
|
17
39
|
end
|
@@ -57,6 +57,15 @@ RSpec.describe Spree::FulfilmentChanger do
|
|
57
57
|
subject
|
58
58
|
end
|
59
59
|
|
60
|
+
it 'updates order totals' do
|
61
|
+
original_total = order.total
|
62
|
+
original_shipment_total = order.shipment_total
|
63
|
+
|
64
|
+
expect { subject }.
|
65
|
+
to change { order.total }.from(original_total).to(original_total + original_shipment_total).
|
66
|
+
and change { order.shipment_total }.by(original_shipment_total)
|
67
|
+
end
|
68
|
+
|
60
69
|
context "when transferring to another stock location" do
|
61
70
|
let(:desired_stock_location) { create(:stock_location) }
|
62
71
|
let!(:stock_item) do
|
@@ -37,7 +37,7 @@ RSpec.describe Spree::Shipment, type: :model do
|
|
37
37
|
end
|
38
38
|
end.to change { Spree::Shipment.count }.by(1)
|
39
39
|
|
40
|
-
new_shipment = order.shipments.last
|
40
|
+
new_shipment = order.shipments.order(:created_at).last
|
41
41
|
expect(new_shipment.number).to_not eq(shipment.number)
|
42
42
|
expect(new_shipment.stock_location).to eq(stock_location)
|
43
43
|
expect(new_shipment.line_items.count).to eq(1)
|
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.5.0.
|
4
|
+
version: 2.5.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|