solidus_sample 2.10.5 → 2.11.0

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: e240aa18d6119987631fe24f38274df395dd931cf8589c95068124f387b392cf
4
- data.tar.gz: ba0d2963629bba724702f90ebd92a4cae4955423bf5d7959318617a391f727b1
3
+ metadata.gz: 0f8a2f2ab2e3f9f51dfb9d1d5ab2bdc9471cd48d2a562374c23583c2e8c3ac55
4
+ data.tar.gz: 880e79010e04dc08d956023fb441df657aa9dbbb3d2e8b4d0f1a0a3d3fc1563a
5
5
  SHA512:
6
- metadata.gz: c3114f476531f46cf9787704fe8517b582763dc921732767ef3eabec01f3d1a65ab32791b350cb780ec46562fac0a9f62c360c93c0b3c6beb3664c3a479c4418
7
- data.tar.gz: 95dfd36a0d0a00f3ce922fbf4f5d5e68ea1bba49e1e64d514b15faf2ae3cef77d869f60f67972be1f6697b24a57e3a1c96be412014e542775308d19b7729737e
6
+ metadata.gz: bd36a810e3671961280a86c569d097641322cceec4a2e7f62874e475257b283856e3e0a26d525c72632b0514ba142de955a6afd6659da3c6dc57f0ea6504319d
7
+ data.tar.gz: 1c966dc593f5da08e27dd9a3d9466965046a8ac599e1000e171951d8fe965c26bc92948f08546b243d576baeb770d798ccbcec333560ec21620815cd05ecff2d
@@ -3,12 +3,10 @@
3
3
  united_states = Spree::Country.find_by!(iso: "US")
4
4
  new_york = Spree::State.find_by!(name: "New York")
5
5
 
6
- first_names = ["Sterling", "Jennette", "Salome", "Lyla", "Lola", "Cheree",
7
- "Hettie", "Barbie", "Amelia", "Marceline", "Keeley", "Mi",
8
- "Karon", "Jessika", "Emmy"]
9
- last_names = ["Torp", "Vandervort", "Stroman", "Lang", "Zulauf", "Bruen",
10
- "Torp", "Gutmann", "Renner", "Bergstrom", "Sauer", "Gaylord",
11
- "Mills", "Daugherty", "Stark"]
6
+ names = ["Sterling Torp", "Jennette Vandervort", "Salome Stroman", "Lyla Lang",
7
+ "Lola Zulauf", "Cheree Bruen", "Hettie Torp", "Barbie Gutmann",
8
+ "Amelia Renner", "Marceline Bergstrom", "Keeley Sauer", "Mi Gaylord",
9
+ "Karon Mills", "Jessika Daugherty", "Emmy Stark"]
12
10
  street_addresses = ["7377 Jacobi Passage", "4725 Serena Ridges",
13
11
  "79832 Hamill Creek", "0746 Genoveva Villages",
14
12
  "86717 D'Amore Hollow", "8529 Delena Well",
@@ -28,8 +26,7 @@ phone_numbers = ["(392)859-7319 x670", "738-831-3210 x6047",
28
26
 
29
27
  2.times do
30
28
  Spree::Address.create!(
31
- firstname: first_names.sample,
32
- lastname: last_names.sample,
29
+ name: names.sample,
33
30
  address1: street_addresses.sample,
34
31
  address2: secondary_addresses.sample,
35
32
  city: cities.sample,
@@ -2,22 +2,45 @@
2
2
 
3
3
  Spree::Sample.load_sample("orders")
4
4
 
5
- order = Spree::Order.last
6
- inventory_unit = order.inventory_units.first
5
+ order = Spree::Order.last
6
+ inventory_unit = order.inventory_units.take!
7
7
  stock_location = inventory_unit.find_stock_item.stock_location
8
+ return_reason = Spree::ReturnReason.active.take!
9
+ preferred_reimbursement_type = Spree::ReimbursementType.where(name: 'Original').take!
10
+ admin_user = if defined?(Spree::Auth)
11
+ Spree.user_class.admin.take!
12
+ else
13
+ Spree.user_class.find_or_create_by!(email: 'admin@example.com')
14
+ end
8
15
 
9
- return_item = Spree::ReturnItem.create(inventory_unit: inventory_unit)
16
+ # Mark the order paid and shipped
17
+ order.payments.pending.each(&:complete)
18
+ order.shipments.each do |shipment|
19
+ shipment.suppress_mailer = false
20
+ shipment.ship!
21
+ end
10
22
 
11
- return_item.exchange_variant = return_item.eligible_exchange_variants.last
12
- return_item.build_exchange_inventory_unit
13
- return_item.accept!
23
+ # Create a return authorization
24
+ return_item = Spree::ReturnItem.new(
25
+ inventory_unit: inventory_unit,
26
+ preferred_reimbursement_type: preferred_reimbursement_type
27
+ )
14
28
 
15
- customer_return = Spree::CustomerReturn.create(
16
- stock_location: stock_location,
17
- return_items: [return_item]
29
+ order.return_authorizations.create!(
30
+ reason: return_reason,
31
+ return_items: [return_item],
32
+ stock_location: stock_location
18
33
  )
19
34
 
20
- order.reimbursements.create(
21
- customer_return: customer_return,
22
- return_items: [return_item]
35
+ # Create a customer return and mark it as received
36
+ customer_return = Spree::CustomerReturn.create!(
37
+ return_items: [return_item],
38
+ stock_location: stock_location
23
39
  )
40
+ return_item.reload
41
+ return_item.receive!
42
+ customer_return.process_return!
43
+
44
+ # Accept the customer return and reimburse it
45
+ reimbursement = Spree::Reimbursement.build_from_customer_return(customer_return)
46
+ reimbursement.return_all(created_by: admin_user)
@@ -11,14 +11,14 @@ Gem::Specification.new do |s|
11
11
 
12
12
  s.author = 'Solidus Team'
13
13
  s.email = 'contact@solidus.io'
14
- s.homepage = 'http://solidus.io/'
14
+ s.homepage = 'http://solidus.io'
15
15
  s.license = 'BSD-3-Clause'
16
16
 
17
- s.files = `git ls-files`.split("\n")
18
- s.require_path = 'lib'
19
- s.requirements << 'none'
17
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(spec|script)/})
19
+ end
20
20
 
21
- s.required_ruby_version = '>= 2.4.0'
21
+ s.required_ruby_version = '>= 2.5.0'
22
22
  s.required_rubygems_version = '>= 1.8.23'
23
23
 
24
24
  s.add_dependency 'solidus_core', s.version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_sample
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.5
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-10 00:00:00.000000000 Z
11
+ date: 2020-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.10.5
19
+ version: 2.11.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.10.5
26
+ version: 2.11.0
27
27
  description: Sample data (including images) for use with Solidus.
28
28
  email: contact@solidus.io
29
29
  executables: []
@@ -89,9 +89,7 @@ files:
89
89
  - lib/spree_sample.rb
90
90
  - lib/tasks/sample.rake
91
91
  - solidus_sample.gemspec
92
- - spec/lib/load_sample_spec.rb
93
- - spec/spec_helper.rb
94
- homepage: http://solidus.io/
92
+ homepage: http://solidus.io
95
93
  licenses:
96
94
  - BSD-3-Clause
97
95
  metadata: {}
@@ -103,15 +101,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
101
  requirements:
104
102
  - - ">="
105
103
  - !ruby/object:Gem::Version
106
- version: 2.4.0
104
+ version: 2.5.0
107
105
  required_rubygems_version: !ruby/object:Gem::Requirement
108
106
  requirements:
109
107
  - - ">="
110
108
  - !ruby/object:Gem::Version
111
109
  version: 1.8.23
112
- requirements:
113
- - none
114
- rubygems_version: 3.1.4
110
+ requirements: []
111
+ rubygems_version: 3.0.3
115
112
  signing_key:
116
113
  specification_version: 4
117
114
  summary: Sample data (including images) for use with Solidus.
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe "Load samples" do
6
- it "doesn't raise any error" do
7
- expect {
8
- Spree::Core::Engine.load_seed
9
- SpreeSample::Engine.load_samples
10
- }.to output.to_stdout
11
- end
12
- end
data/spec/spec_helper.rb DELETED
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This file is copied to ~/spec when you run 'ruby script/generate rspec'
4
- # from the project root directory.
5
- ENV["RAILS_ENV"] ||= 'test'
6
-
7
- require 'solidus_sample'
8
- require 'spree/testing_support/dummy_app'
9
- DummyApp.setup(
10
- gem_root: File.expand_path('..', __dir__),
11
- lib_name: 'solidus_sample'
12
- )
13
-
14
- require 'rspec/rails'
15
- require 'database_cleaner'
16
-
17
- RSpec.configure do |config|
18
- config.color = true
19
- config.infer_spec_type_from_file_location!
20
- config.expect_with :rspec do |c|
21
- c.syntax = :expect
22
- end
23
- config.mock_with :rspec do |c|
24
- c.syntax = :expect
25
- end
26
-
27
- config.before(:each) do
28
- DatabaseCleaner.clean_with(:truncation)
29
- end
30
-
31
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
32
- # examples within a transaction, comment the following line or assign false
33
- # instead of true.
34
- config.use_transactional_fixtures = false
35
-
36
- config.example_status_persistence_file_path = "./spec/examples.txt"
37
-
38
- config.order = :random
39
-
40
- Kernel.srand config.seed
41
- end