spree_core 3.1.0 → 3.1.1
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.
- checksums.yaml +4 -4
- data/app/models/spree/order.rb +2 -2
- data/app/models/spree/shipment.rb +1 -1
- data/config/locales/en.yml +0 -4
- data/lib/spree/core/version.rb +1 -1
- data/spec/lib/spree/core/importer/order_spec.rb +1 -1
- data/spec/models/spree/asset_spec.rb +8 -5
- data/spec/models/spree/order/store_credit_spec.rb +3 -0
- data/spec/models/spree/order_spec.rb +4 -4
- data/spec/models/spree/product_spec.rb +15 -16
- data/spec/models/spree/store_credit_spec.rb +4 -4
- data/spec/models/spree/user_spec.rb +10 -4
- data/spree_core.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92d2afeeba8bb057bcc78631c40187c1a5e77670
|
4
|
+
data.tar.gz: 80cbb5297dc213e88e6e6a77d159a1ef6c5bea9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 062f9429e4900f53a5f5925a29188ecdd56a63820f84fdbe43454a83393011c8e144b7e6349732a21cef8cf6fc02de2a94a7dc5b52eef0ddc78fb20aa4653404
|
7
|
+
data.tar.gz: ace59dff074f95170b53c700edf77f15313e9b52eb42666f656fe0acdc99dff915b79f4330df4e6783326de0fce2d71def5e1bd2df26b4923cbf7c841b5930ec
|
data/app/models/spree/order.rb
CHANGED
@@ -417,8 +417,8 @@ module Spree
|
|
417
417
|
# If so add error and restart checkout.
|
418
418
|
def ensure_line_item_variants_are_not_discontinued
|
419
419
|
if line_items.any?{ |li| !li.variant || li.variant.discontinued? }
|
420
|
-
errors.add(:base, Spree.t(:discontinued_variants_present))
|
421
420
|
restart_checkout_flow
|
421
|
+
errors.add(:base, Spree.t(:discontinued_variants_present))
|
422
422
|
false
|
423
423
|
else
|
424
424
|
true
|
@@ -427,8 +427,8 @@ module Spree
|
|
427
427
|
|
428
428
|
def ensure_line_items_are_in_stock
|
429
429
|
if insufficient_stock_lines.present?
|
430
|
-
errors.add(:base, Spree.t(:insufficient_stock_lines_present))
|
431
430
|
restart_checkout_flow
|
431
|
+
errors.add(:base, Spree.t(:insufficient_stock_lines_present))
|
432
432
|
false
|
433
433
|
else
|
434
434
|
true
|
@@ -17,9 +17,9 @@ module Spree
|
|
17
17
|
has_many :adjustments, as: :adjustable
|
18
18
|
has_many :inventory_units, inverse_of: :shipment
|
19
19
|
has_many :shipping_rates, -> { order(:cost) }
|
20
|
+
has_many :state_changes, as: :stateful
|
20
21
|
end
|
21
22
|
has_many :shipping_methods, through: :shipping_rates
|
22
|
-
has_many :state_changes, as: :stateful
|
23
23
|
|
24
24
|
after_save :update_adjustments
|
25
25
|
|
data/config/locales/en.yml
CHANGED
@@ -350,10 +350,6 @@ en:
|
|
350
350
|
attributes:
|
351
351
|
base:
|
352
352
|
cannot_destroy_if_attached_to_line_items: Cannot delete variants once they are attached to line items.
|
353
|
-
spree/shipping_method:
|
354
|
-
attributes:
|
355
|
-
base:
|
356
|
-
cannot_destroy_if_attached_to_line_items: Cannot delete variants once they are attached to line items.
|
357
353
|
|
358
354
|
devise:
|
359
355
|
confirmations:
|
data/lib/spree/core/version.rb
CHANGED
@@ -588,7 +588,7 @@ module Spree
|
|
588
588
|
]
|
589
589
|
}
|
590
590
|
order = Importer::Order.import(user, params)
|
591
|
-
expect(order.payments.first.created_at).to be_within(
|
591
|
+
expect(order.payments.first.created_at).to be_within(1).of created_at
|
592
592
|
end
|
593
593
|
|
594
594
|
context "raises error" do
|
@@ -3,12 +3,15 @@ require 'spec_helper'
|
|
3
3
|
describe Spree::Asset, :type => :model do
|
4
4
|
describe "#viewable" do
|
5
5
|
it "touches association" do
|
6
|
-
|
7
|
-
asset = Spree::Asset.create! { |a| a.viewable = product.master }
|
6
|
+
Timecop.scale(3600) do
|
8
7
|
|
9
|
-
|
10
|
-
asset.
|
11
|
-
|
8
|
+
product = create(:custom_product)
|
9
|
+
asset = Spree::Asset.create! { |a| a.viewable = product.master }
|
10
|
+
|
11
|
+
expect do
|
12
|
+
asset.touch
|
13
|
+
end.to change { product.reload.updated_at }
|
14
|
+
end
|
12
15
|
end
|
13
16
|
end
|
14
17
|
|
@@ -96,10 +96,13 @@ describe 'Order' do
|
|
96
96
|
let(:order) { create(:order, user: primary_store_credit.user, total: order_total) }
|
97
97
|
|
98
98
|
before do
|
99
|
+
Timecop.scale(3600)
|
99
100
|
subject
|
100
101
|
order.reload
|
101
102
|
end
|
102
103
|
|
104
|
+
after { Timecop.return }
|
105
|
+
|
103
106
|
it 'uses the primary store credit type over the secondary' do
|
104
107
|
primary_payment = order.payments.first
|
105
108
|
secondary_payment = order.payments.last
|
@@ -238,7 +238,6 @@ describe Spree::Order, :type => :model do
|
|
238
238
|
|
239
239
|
context 'when variant is destroyed' do
|
240
240
|
before do
|
241
|
-
allow(order).to receive(:restart_checkout_flow)
|
242
241
|
order.line_items.first.variant.discontinue!
|
243
242
|
end
|
244
243
|
|
@@ -272,14 +271,14 @@ describe Spree::Order, :type => :model do
|
|
272
271
|
describe '#ensure_line_items_are_in_stock' do
|
273
272
|
subject { order.ensure_line_items_are_in_stock }
|
274
273
|
|
275
|
-
let(:line_item) {
|
274
|
+
let(:line_item) { create(:line_item, order: order) }
|
276
275
|
|
277
276
|
before do
|
278
|
-
allow(order).to receive(:
|
279
|
-
allow(order).to receive_messages(:line_items => [line_item])
|
277
|
+
allow(order).to receive(:insufficient_stock_lines).and_return([true])
|
280
278
|
end
|
281
279
|
|
282
280
|
it 'should restart checkout flow' do
|
281
|
+
allow(order).to receive(:restart_checkout_flow)
|
283
282
|
expect(order).to receive(:restart_checkout_flow).once
|
284
283
|
subject
|
285
284
|
end
|
@@ -290,6 +289,7 @@ describe Spree::Order, :type => :model do
|
|
290
289
|
end
|
291
290
|
|
292
291
|
it 'should be false' do
|
292
|
+
allow(order).to receive(:restart_checkout_flow)
|
293
293
|
expect(subject).to be_falsey
|
294
294
|
end
|
295
295
|
end
|
@@ -21,6 +21,21 @@ describe Spree::Product, :type => :model do
|
|
21
21
|
is_expected.to have_many(:possible_promotions).
|
22
22
|
class_name('Spree::Promotion').through(:promotion_rules).source(:promotion)
|
23
23
|
end
|
24
|
+
|
25
|
+
it do
|
26
|
+
is_expected.to have_many(:variants).
|
27
|
+
class_name('Spree::Variant').
|
28
|
+
inverse_of(:product).
|
29
|
+
conditions(is_master: false).
|
30
|
+
order(:position)
|
31
|
+
end
|
32
|
+
|
33
|
+
it do
|
34
|
+
is_expected.to have_many(:variants_including_master).
|
35
|
+
class_name('Spree::Variant').
|
36
|
+
inverse_of(:product).
|
37
|
+
order(:position)
|
38
|
+
end
|
24
39
|
end
|
25
40
|
|
26
41
|
context 'product instance' do
|
@@ -182,22 +197,6 @@ describe Spree::Product, :type => :model do
|
|
182
197
|
end
|
183
198
|
end
|
184
199
|
|
185
|
-
describe 'Variants sorting' do
|
186
|
-
ORDER_REGEXP = /ORDER BY (\`|\")spree_variants(\`|\").(\'|\")position(\'|\") ASC/
|
187
|
-
|
188
|
-
context 'without master variant' do
|
189
|
-
it 'sorts variants by position' do
|
190
|
-
expect(product.variants.to_sql).to match(ORDER_REGEXP)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
context 'with master variant' do
|
195
|
-
it 'sorts variants by position' do
|
196
|
-
expect(product.variants_including_master.to_sql).to match(ORDER_REGEXP)
|
197
|
-
end
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
200
|
context "has stock movements" do
|
202
201
|
let(:variant) { product.master }
|
203
202
|
let(:stock_item) { variant.stock_items.first }
|
@@ -180,7 +180,7 @@ describe 'StoreCredit' do
|
|
180
180
|
end
|
181
181
|
|
182
182
|
context 'originator is present' do
|
183
|
-
with_model 'OriginatorThing'
|
183
|
+
with_model 'OriginatorThing', scope: :all
|
184
184
|
|
185
185
|
let(:originator) { OriginatorThing.create! } # won't actually be a user. just giving it a valid model here
|
186
186
|
|
@@ -335,7 +335,7 @@ describe 'StoreCredit' do
|
|
335
335
|
end
|
336
336
|
|
337
337
|
context 'originator is present' do
|
338
|
-
with_model 'OriginatorThing'
|
338
|
+
with_model 'OriginatorThing', scope: :all
|
339
339
|
|
340
340
|
let(:originator) { OriginatorThing.create! } # won't actually be a user. just giving it a valid model here
|
341
341
|
|
@@ -407,7 +407,7 @@ describe 'StoreCredit' do
|
|
407
407
|
end
|
408
408
|
|
409
409
|
context 'originator is present' do
|
410
|
-
with_model 'OriginatorThing'
|
410
|
+
with_model 'OriginatorThing', scope: :all
|
411
411
|
|
412
412
|
let(:originator) { OriginatorThing.create! } # won't actually be a user. just giving it a valid model here
|
413
413
|
|
@@ -534,7 +534,7 @@ describe 'StoreCredit' do
|
|
534
534
|
end
|
535
535
|
|
536
536
|
context 'originator is present' do
|
537
|
-
with_model 'OriginatorThing'
|
537
|
+
with_model 'OriginatorThing', scope: :all
|
538
538
|
|
539
539
|
let(:originator) { OriginatorThing.create! } # won't actually be a user. just giving it a valid model here
|
540
540
|
|
@@ -6,12 +6,18 @@ describe Spree::LegacyUser, type: :model do
|
|
6
6
|
let!(:user) { create(:user) }
|
7
7
|
let!(:order) { create(:order, bill_address: create(:address), ship_address: create(:address)) }
|
8
8
|
|
9
|
-
let
|
10
|
-
let
|
11
|
-
let
|
9
|
+
let(:order_1) { create(:order, created_at: 1.day.ago, user: user, created_by: user) }
|
10
|
+
let(:order_2) { create(:order, user: user, created_by: user) }
|
11
|
+
let(:order_3) { create(:order, user: user, created_by: create(:user)) }
|
12
12
|
|
13
13
|
it 'returns correct order' do
|
14
|
-
|
14
|
+
Timecop.scale(3600) do
|
15
|
+
order_1
|
16
|
+
order_2
|
17
|
+
order_3
|
18
|
+
|
19
|
+
expect(user.last_incomplete_spree_order).to eq order_3
|
20
|
+
end
|
15
21
|
end
|
16
22
|
|
17
23
|
context 'persists order address' do
|
data/spree_core.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.add_dependency 'paperclip', '~> 4.3.0'
|
35
35
|
s.add_dependency 'paranoia', '~> 2.1.0'
|
36
36
|
s.add_dependency 'premailer-rails'
|
37
|
-
s.add_dependency 'rails', '~> 4.2.
|
37
|
+
s.add_dependency 'rails', '~> 4.2.7.1'
|
38
38
|
s.add_dependency 'ransack', '~> 1.4.1'
|
39
39
|
s.add_dependency 'responders'
|
40
40
|
s.add_dependency 'state_machines-activerecord', '~> 0.2'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -226,14 +226,14 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: 4.2.
|
229
|
+
version: 4.2.7.1
|
230
230
|
type: :runtime
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version: 4.2.
|
236
|
+
version: 4.2.7.1
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: ransack
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1163,7 +1163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1163
1163
|
version: 1.8.23
|
1164
1164
|
requirements: []
|
1165
1165
|
rubyforge_project:
|
1166
|
-
rubygems_version: 2.
|
1166
|
+
rubygems_version: 2.5.1
|
1167
1167
|
signing_key:
|
1168
1168
|
specification_version: 4
|
1169
1169
|
summary: The bare bones necessary for Spree.
|