solidus_core 2.5.0.beta2 → 2.5.0.rc1

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: eea3e082ced1d6d489258eb5eb17e2f9d69d455be304f10d947cd4eb82f6d3ce
4
- data.tar.gz: ab928452cf6ce9bd4bb658e7878ce7a816f56cc44cc2ff1e14faa26a642c8e40
3
+ metadata.gz: 5d3194680467637f6a7a10a8f57260d6fe8a69584e6f4694b64d4917fb1d20ea
4
+ data.tar.gz: f24092cc442961ccc16f8bcff07433d9ca52d321b0f776162f9483b9ffa09a30
5
5
  SHA512:
6
- metadata.gz: 3341402dad6a4a27e844aa6390c4fc5fe73c56e757798503362d74842cbb17e2fa1389bfab3b1f88965e7e18eeb465b3897f29585e0b646d2dd30a22ce002732
7
- data.tar.gz: e3e782f4b5f4faa8f0355460eb4a737479cf36094ca2fd3032c068d602f1a21f42069e80dfc8b90ef883fef115b2c61a1b15995dcebd7f4775b4b0c8e189c33b
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
- products = taxon.active_products.select("DISTINCT (spree_products.id), spree_products.*, spree_products_taxons.position").limit(max)
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
@@ -96,6 +96,10 @@ module Spree
96
96
  # are up-to-date, too.
97
97
  desired_shipment.refresh_rates
98
98
 
99
+ # In order to reflect the changes in the order totals
100
+ desired_shipment.order.reload
101
+ desired_shipment.order.recalculate
102
+
99
103
  true
100
104
  end
101
105
 
@@ -1,6 +1,6 @@
1
1
  module Spree
2
2
  def self.solidus_version
3
- "2.5.0.beta2"
3
+ "2.5.0.rc1"
4
4
  end
5
5
 
6
6
  def self.solidus_gem_version
@@ -1,17 +1,39 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  RSpec.describe Spree::TaxonsHelper, type: :helper do
4
- # Regression test for https://github.com/spree/spree/issues/4382
5
- it "#taxon_preview" do
6
- taxon = create(:taxon)
7
- child_taxon = create(:taxon, parent: taxon)
8
- product_1 = create(:product)
9
- product_2 = create(:product)
10
- product_3 = create(:product)
11
- taxon.products << product_1
12
- taxon.products << product_2
13
- child_taxon.products << product_3
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
- expect(taxon_preview(taxon.reload)).to eql([product_1, product_2, product_3])
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.beta2
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-02-20 00:00:00.000000000 Z
11
+ date: 2018-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer