spree_core 4.4.0.rc1 → 4.4.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7688ca0eb67dbbcd2236ebafb2c3eed22d8d29dbf40924d82b52eba8bf52db9e
4
- data.tar.gz: '0689424db68d0822931238faad67fcc9292e0f2cd5487ed6c234acbea8b79720'
3
+ metadata.gz: 6068db45525230da41ca606788cebd91ab374323e4e74497da8be61f0078d708
4
+ data.tar.gz: 0d2d9dd7d2f9e100e410a71704e231f97e4be1fe7ada6f468ceb783d9780bcac
5
5
  SHA512:
6
- metadata.gz: 4d8dd9a06af740248a017b5f2b608f11cf19f5df647129837de2c3248c529da621402928dce4c5d9338ded7bb4282509eb0723d772a1a93b9006c8845d213fc6
7
- data.tar.gz: 7d9689023479c36a36407b650d870d0640f38bff6c456b4722579f5bd0cb9b29a937a9b8c476862e1adcc8bc3339dd801ae4e2b6e8ecf0564e35830d8abc3842
6
+ metadata.gz: db2b58e61632b424a69e058b882daef3713d05d39bd49d818432a3028eab14d8ee4817fa8ca94633b71c287cca77ef9b2ad40c959d34a1e978da5be1b0ad6a37
7
+ data.tar.gz: '08cc33ae6f5f6e8917d94b26831342bf9e7cc1db94db85923d1d01fd1c06ed323b983d64d90725697c42f938a952a0127799cf98b06937b74cb9416171dee0f6'
@@ -2,7 +2,7 @@ module Spree
2
2
  class Calculator < Spree::Base
3
3
  acts_as_paranoid
4
4
 
5
- belongs_to :calculable, polymorphic: true, optional: true
5
+ belongs_to :calculable, polymorphic: true, optional: true, inverse_of: :calculator
6
6
 
7
7
  # This method calls a compute_<computable> method. must be overridden in concrete calculator.
8
8
  #
@@ -38,6 +38,7 @@ module Spree
38
38
  money_methods :pre_tax_total
39
39
 
40
40
  self.whitelisted_ransackable_attributes = ['memo', 'number', 'state']
41
+ self.whitelisted_ransackable_associations = ['order']
41
42
 
42
43
  def pre_tax_total
43
44
  return_items.sum(:pre_tax_amount)
@@ -250,7 +250,7 @@ module Spree
250
250
  def associate_credit_type
251
251
  unless type_id
252
252
  credit_type_name = category.try(:non_expiring?) ? 'Non-expiring' : 'Expiring'
253
- self.credit_type = Spree::StoreCreditType.find_by(name: credit_type_name)
253
+ self.credit_type = Spree::StoreCreditType.find_or_create_by(name: credit_type_name)
254
254
  end
255
255
  end
256
256
  end
@@ -6,6 +6,8 @@ module Spree
6
6
  def call
7
7
  # FIXME: we should use translations here
8
8
  Spree::StoreCreditCategory.find_or_create_by!(name: 'Default')
9
+ Spree::StoreCreditCategory.find_or_create_by!(name: 'Non-expiring')
10
+ Spree::StoreCreditCategory.find_or_create_by!(name: 'Expiring')
9
11
  end
10
12
  end
11
13
  end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
- VERSION = '4.4.0.rc1'.freeze
2
+ VERSION = '4.4.0.rc2'.freeze
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -0,0 +1,23 @@
1
+ shared_examples_for 'metadata' do |factory: described_class.name.demodulize.underscore.to_sym|
2
+ subject { FactoryBot.create(factory) }
3
+
4
+ it { expect(subject.has_attribute?(:public_metadata)).to be_truthy }
5
+ it { expect(subject.has_attribute?(:private_metadata)).to be_truthy }
6
+
7
+ it { expect(subject.public_metadata.class).to eq(HashWithIndifferentAccess) }
8
+ it { expect(subject.private_metadata.class).to eq(HashWithIndifferentAccess) }
9
+
10
+ it do
11
+ string = subject.public_metadata[:color] = 'red'
12
+ number = subject.public_metadata[:priority] = 1
13
+ array = subject.public_metadata[:keywords] = ['k1', 'k2']
14
+ hash = subject.public_metadata[:additional_data] = { size: 'big', material: 'wool' }
15
+
16
+ subject.save!
17
+
18
+ expect(subject.public_metadata[:color]).to eq(string)
19
+ expect(subject.public_metadata[:priority]).to eq(number)
20
+ expect(subject.public_metadata[:keywords]).to eq(array)
21
+ expect(subject.public_metadata[:additional_data]).to eq(hash.stringify_keys)
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0.rc1
4
+ version: 4.4.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-12-04 00:00:00.000000000 Z
12
+ date: 2022-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -954,6 +954,7 @@ files:
954
954
  - lib/spree/testing_support/jobs.rb
955
955
  - lib/spree/testing_support/kernel.rb
956
956
  - lib/spree/testing_support/locale_helpers.rb
957
+ - lib/spree/testing_support/metadata.rb
957
958
  - lib/spree/testing_support/next_instance_of.rb
958
959
  - lib/spree/testing_support/order_walkthrough.rb
959
960
  - lib/spree/testing_support/preferences.rb
@@ -976,9 +977,9 @@ licenses:
976
977
  - BSD-3-Clause
977
978
  metadata:
978
979
  bug_tracker_uri: https://github.com/spree/spree/issues
979
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.4.0.rc1
980
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.4.0.rc2
980
981
  documentation_uri: https://dev-docs.spreecommerce.org/
981
- source_code_uri: https://github.com/spree/spree/tree/v4.4.0.rc1
982
+ source_code_uri: https://github.com/spree/spree/tree/v4.4.0.rc2
982
983
  post_install_message:
983
984
  rdoc_options: []
984
985
  require_paths:
@@ -994,7 +995,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
994
995
  - !ruby/object:Gem::Version
995
996
  version: 1.8.23
996
997
  requirements: []
997
- rubygems_version: 3.2.22
998
+ rubygems_version: 3.2.32
998
999
  signing_key:
999
1000
  specification_version: 4
1000
1001
  summary: The bare bones necessary for Spree