solidus_core 2.8.1 → 2.8.2
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 +4 -4
- data/db/migrate/20180710170104_create_spree_store_credit_reasons_table.rb +20 -7
- data/db/migrate/20190106184413_remove_code_from_spree_promotions.rb +2 -1
- data/lib/spree/core/version.rb +1 -1
- data/spec/migrate/20190106184413_remove_code_from_spree_promotions_spec.rb +20 -8
- 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: 5b97bcb067eec1433b2f01d45c66c881e4029bba591ca53a3e3a9118f14392cb
|
4
|
+
data.tar.gz: 11de3f68e6f50ae439477ddf23b21f62f7200e7ad90172116e054215e34ebfb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59b2593c7b3f0b12ae9a6b1eed82ff49f2f753733452a4d9cbf0ef3e7ef42498ae213070336c22dfbbb1c363be7a108855ea00f9019594690fd2c4def752b3f7
|
7
|
+
data.tar.gz: 9060ad03693075e534b219f75d423de322569e25f806c702be946920e0b981503bfb8c417d498ff75094cf3a0396415d1f5b48d21497d85ead39cfc8eac99388
|
@@ -21,15 +21,28 @@ class CreateSpreeStoreCreditReasonsTable < ActiveRecord::Migration[5.1]
|
|
21
21
|
StoreCreditReason.create!(name: update_reason.name)
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
add_column :spree_store_credit_events, :store_credit_reason_id, :integer
|
25
|
+
execute "update spree_store_credit_events set store_credit_reason_id = update_reason_id"
|
26
|
+
|
27
|
+
# TODO: table spree_store_credit_update_reasons and column
|
28
|
+
# column spree_store_credit_update_reasons.update_reason_id
|
29
|
+
# must be dropped in a future Solidus release
|
26
30
|
end
|
27
31
|
|
28
32
|
def down
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
+
# This table and column may not exist anymore as another irreversible
|
34
|
+
# migration may have removed it later. They must be added back or the
|
35
|
+
# `up` method would fail
|
36
|
+
unless table_exists? :spree_store_credit_update_reasons
|
37
|
+
create_table :spree_store_credit_update_reasons do |t|
|
38
|
+
t.string :name
|
39
|
+
|
40
|
+
t.timestamps
|
41
|
+
end
|
42
|
+
|
43
|
+
unless column_exists? :spree_store_credit_events, :update_reason_id
|
44
|
+
add_column :spree_store_credit_events, :update_reason_id, :integer
|
45
|
+
end
|
33
46
|
end
|
34
47
|
|
35
48
|
StoreCreditReason.all.each do |store_credit_reason|
|
@@ -37,6 +50,6 @@ class CreateSpreeStoreCreditReasonsTable < ActiveRecord::Migration[5.1]
|
|
37
50
|
end
|
38
51
|
|
39
52
|
drop_table :spree_store_credit_reasons
|
40
|
-
|
53
|
+
remove_column :spree_store_credit_events, :store_credit_reason_id
|
41
54
|
end
|
42
55
|
end
|
@@ -5,10 +5,11 @@ require 'solidus/migrations/promotions_with_code_handlers'
|
|
5
5
|
class RemoveCodeFromSpreePromotions < ActiveRecord::Migration[5.1]
|
6
6
|
class Promotion < ActiveRecord::Base
|
7
7
|
self.table_name = "spree_promotions"
|
8
|
+
self.ignored_columns = %w(type)
|
8
9
|
end
|
9
10
|
|
10
11
|
def up
|
11
|
-
promotions_with_code = Promotion.where.not(code: nil)
|
12
|
+
promotions_with_code = Promotion.where.not(code: [nil, ''])
|
12
13
|
|
13
14
|
if promotions_with_code.any?
|
14
15
|
# You have some promotions with "code" field present! This is not good
|
data/lib/spree/core/version.rb
CHANGED
@@ -44,7 +44,18 @@ RSpec.describe RemoveCodeFromSpreePromotions do
|
|
44
44
|
DatabaseCleaner.clean_with(:truncation)
|
45
45
|
end
|
46
46
|
|
47
|
+
let(:promotion_with_code) { create(:promotion) }
|
48
|
+
|
49
|
+
before do
|
50
|
+
# We can't set code via factory since `code=` is currently raising
|
51
|
+
# an error, see more at:
|
52
|
+
# https://github.com/solidusio/solidus/blob/cf96b03eb9e80002b69736e082fd485c870ab5d9/core/app/models/spree/promotion.rb#L65
|
53
|
+
promotion_with_code.update_column(:code, code)
|
54
|
+
end
|
55
|
+
|
47
56
|
context 'when there are no promotions with code' do
|
57
|
+
let(:code) { '' }
|
58
|
+
|
48
59
|
it 'does not call any promotion with code handler' do
|
49
60
|
expect(described_class).not_to receive(:promotions_with_code_handler)
|
50
61
|
|
@@ -53,14 +64,7 @@ RSpec.describe RemoveCodeFromSpreePromotions do
|
|
53
64
|
end
|
54
65
|
|
55
66
|
context 'when there are promotions with code' do
|
56
|
-
let(:
|
57
|
-
|
58
|
-
before do
|
59
|
-
# We can't set code via factory since `code=` is currently raising
|
60
|
-
# an error, see more at:
|
61
|
-
# https://github.com/solidusio/solidus/blob/cf96b03eb9e80002b69736e082fd485c870ab5d9/core/app/models/spree/promotion.rb#L65
|
62
|
-
promotion_with_code.update_column(:code, 'Just An Old Promo Code')
|
63
|
-
end
|
67
|
+
let(:code) { 'Just An Old Promo Code' }
|
64
68
|
|
65
69
|
context 'with the deafult handler (Solidus::Migrations::PromotionWithCodeHandlers::RaiseException)' do
|
66
70
|
it 'raise a StandardError exception' do
|
@@ -96,6 +100,14 @@ RSpec.describe RemoveCodeFromSpreePromotions do
|
|
96
100
|
end
|
97
101
|
end
|
98
102
|
|
103
|
+
context 'with promotions with type set (legacy feature)' do
|
104
|
+
let(:promotion_with_code) { create(:promotion, type: 'Spree::Promotion') }
|
105
|
+
|
106
|
+
it 'does not raise a STI error' do
|
107
|
+
expect { subject }.not_to raise_error
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
99
111
|
context 'when there is a Spree::PromotionCode with the same value' do
|
100
112
|
context 'associated with the same promotion' do
|
101
113
|
let!(:existing_promotion_code) { create(:promotion_code, value: 'just an old promo code', promotion: promotion_with_code) }
|
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.2
|
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-02-
|
11
|
+
date: 2019-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|