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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6a0e506dd5c20cd114029a4d8f7cf6c9dff0ef0ce08c3b92cdd24e39b58f97e
4
- data.tar.gz: 1936cc0f6fda95d9a4931b584eeec1c3529d64dec7aee80c92e0b58183d0c19b
3
+ metadata.gz: 5b97bcb067eec1433b2f01d45c66c881e4029bba591ca53a3e3a9118f14392cb
4
+ data.tar.gz: 11de3f68e6f50ae439477ddf23b21f62f7200e7ad90172116e054215e34ebfb9
5
5
  SHA512:
6
- metadata.gz: fd93440711741bf2970e57db6cc86325f0ae2faa28642651a959f40004bf9b384cd39343d23836ef6bdb5565c04aa818822b1443284c3feee93ebdc51b4b4b84
7
- data.tar.gz: 46461444d4462294444911f9ec1a7da35e75e82a3713e62879ef7e08cc4f58cc02b01eefd2678cee624cd3158ad165a28c0ecefb9c456cf1df5167af1b812550
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
- drop_table :spree_store_credit_update_reasons
25
- rename_column :spree_store_credit_events, :update_reason_id, :store_credit_reason_id
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
- create_table :spree_store_credit_update_reasons do |t|
30
- t.string :name
31
-
32
- t.timestamps
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
- rename_column :spree_store_credit_events, :store_credit_reason_id, :update_reason_id
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Spree
4
4
  def self.solidus_version
5
- "2.8.1"
5
+ "2.8.2"
6
6
  end
7
7
 
8
8
  def self.solidus_gem_version
@@ -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(:promotion_with_code) { create(:promotion) }
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.1
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-13 00:00:00.000000000 Z
11
+ date: 2019-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer