goca-spree-core 3.1.14.rails.5.0 → 3.1.14.rails.5.0.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/helpers/spree/base_helper.rb +1 -1
- data/app/models/application_record.rb +3 -0
- data/app/models/spree/app_configuration.rb +7 -0
- data/app/models/spree/base.rb +1 -1
- data/app/models/spree/calculator.rb +1 -1
- data/app/models/spree/country.rb +1 -1
- data/app/models/spree/credit_card.rb +5 -2
- data/app/models/spree/gateway/bogus.rb +11 -11
- data/app/models/spree/gateway/bogus_simple.rb +4 -4
- data/app/models/spree/gateway.rb +1 -1
- data/app/models/spree/image.rb +2 -2
- data/app/models/spree/inventory_unit.rb +6 -10
- data/app/models/spree/line_item.rb +3 -3
- data/app/models/spree/order_contents.rb +4 -2
- data/app/models/spree/payment/processing.rb +1 -1
- data/app/models/spree/preferences/store.rb +3 -3
- data/app/models/spree/product/scopes.rb +13 -13
- data/app/models/spree/product.rb +2 -2
- data/app/models/spree/promotion/rules/taxon.rb +1 -1
- data/app/models/spree/promotion.rb +1 -1
- data/app/models/spree/promotion_handler/cart.rb +1 -14
- data/app/models/spree/promotion_handler/page.rb +2 -2
- data/app/models/spree/refund_reason.rb +1 -1
- data/app/models/spree/reimbursement_type.rb +5 -1
- data/app/models/spree/return_item.rb +1 -1
- data/app/models/spree/stock/inventory_unit_builder.rb +1 -1
- data/app/models/spree/stock_movement.rb +11 -6
- data/app/models/spree/store.rb +1 -0
- data/app/models/spree/store_credit.rb +1 -1
- data/app/models/spree/taxon.rb +2 -2
- data/app/models/spree/variant.rb +7 -4
- data/app/models/spree/zone.rb +2 -2
- data/app/validators/db_maximum_length_validator.rb +5 -1
- data/config/initializers/friendly_id.rb +0 -81
- data/db/default/spree/countries.rb +1 -1
- data/db/default/spree/roles.rb +2 -2
- data/db/default/spree/states.rb +1 -1
- data/lib/generators/spree/custom_user/custom_user_generator.rb +1 -1
- data/lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt +3 -3
- data/lib/generators/spree/custom_user/templates/migration.rb.tt +2 -2
- data/lib/generators/spree/dummy/dummy_generator.rb +11 -11
- data/lib/generators/spree/dummy/templates/rails/application.rb +1 -1
- data/lib/generators/spree/dummy/templates/rails/database.yml +9 -6
- data/lib/generators/spree/dummy/templates/rails/test.rb +1 -1
- data/lib/generators/spree/install/install_generator.rb +10 -10
- data/lib/spree/core/controller_helpers/respond_with.rb +1 -1
- data/lib/spree/core/delegate_belongs_to.rb +2 -2
- data/lib/spree/core/importer/product.rb +2 -2
- data/lib/spree/core/product_duplicator.rb +1 -1
- data/lib/spree/core/product_filters.rb +1 -1
- data/lib/spree/core/search/base.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/i18n/initializer.rb +1 -1
- data/lib/spree/localized_number.rb +3 -0
- data/lib/spree/permitted_attributes.rb +1 -1
- data/lib/spree/testing_support/caching.rb +3 -3
- data/lib/spree/testing_support/controller_requests.rb +4 -4
- data/lib/spree/testing_support/kernel.rb +18 -0
- data/lib/spree/testing_support/order_walkthrough.rb +4 -4
- data/lib/tasks/core.rake +2 -2
- data/spree_core.gemspec +2 -2
- metadata +5 -3
data/app/models/spree/zone.rb
CHANGED
@@ -33,7 +33,7 @@ module Spree
|
|
33
33
|
# Match zones of the same kind with similar countries
|
34
34
|
joins(countries: :zones).
|
35
35
|
where("zone_members_spree_countries_join.zone_id = ?", zone.id).
|
36
|
-
|
36
|
+
distinct
|
37
37
|
else
|
38
38
|
# Match zones of the same kind with similar states in AND match zones
|
39
39
|
# that have the states countries in
|
@@ -44,7 +44,7 @@ module Spree
|
|
44
44
|
spree_zone_members.zoneable_id IN (?))",
|
45
45
|
zone.state_ids,
|
46
46
|
zone.states.pluck(:country_id)
|
47
|
-
).
|
47
|
+
).distinct
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -2,7 +2,11 @@
|
|
2
2
|
# Validates a field based on the maximum length of the underlying DB field, if there is one.
|
3
3
|
class DbMaximumLengthValidator < ActiveModel::EachValidator
|
4
4
|
def validate_each(record, attribute, value)
|
5
|
-
|
5
|
+
if defined?(Globalize)
|
6
|
+
limit = record.class.translation_class.columns_hash[attribute.to_s].limit
|
7
|
+
else
|
8
|
+
limit = record.class.columns_hash[attribute.to_s].limit
|
9
|
+
end
|
6
10
|
value = record[attribute.to_sym]
|
7
11
|
if value && limit && value.to_s.length > limit
|
8
12
|
record.errors.add(attribute.to_sym, :too_long, count: limit)
|
@@ -1,88 +1,7 @@
|
|
1
|
-
# FriendlyId Global Configuration
|
2
|
-
#
|
3
|
-
# Use this to set up shared configuration options for your entire application.
|
4
|
-
# Any of the configuration options shown here can also be applied to single
|
5
|
-
# models by passing arguments to the `friendly_id` class method or defining
|
6
|
-
# methods in your model.
|
7
|
-
#
|
8
1
|
# To learn more, check out the guide:
|
9
|
-
#
|
10
2
|
# http://norman.github.io/friendly_id/file.Guide.html
|
11
|
-
|
12
3
|
FriendlyId.defaults do |config|
|
13
|
-
# ## Reserved Words
|
14
|
-
#
|
15
|
-
# Some words could conflict with Rails's routes when used as slugs, or are
|
16
|
-
# undesirable to allow as slugs. Edit this list as needed for your app.
|
17
4
|
config.use :reserved
|
18
|
-
|
19
5
|
config.reserved_words = %w(new edit index session login logout users admin
|
20
6
|
stylesheets assets javascripts images)
|
21
|
-
|
22
|
-
# ## Friendly Finders
|
23
|
-
#
|
24
|
-
# Uncomment this to use friendly finders in all models. By default, if
|
25
|
-
# you wish to find a record by its friendly id, you must do:
|
26
|
-
#
|
27
|
-
# MyModel.friendly.find('foo')
|
28
|
-
#
|
29
|
-
# If you uncomment this, you can do:
|
30
|
-
#
|
31
|
-
# MyModel.find('foo')
|
32
|
-
#
|
33
|
-
# This is significantly more convenient but may not be appropriate for
|
34
|
-
# all applications, so you must explicity opt-in to this behavior. You can
|
35
|
-
# always also configure it on a per-model basis if you prefer.
|
36
|
-
#
|
37
|
-
# Something else to consider is that using the :finders addon boosts
|
38
|
-
# performance because it will avoid Rails-internal code that makes runtime
|
39
|
-
# calls to `Module.extend`.
|
40
|
-
#
|
41
|
-
# config.use :finders
|
42
|
-
#
|
43
|
-
# ## Slugs
|
44
|
-
#
|
45
|
-
# Most applications will use the :slugged module everywhere. If you wish
|
46
|
-
# to do so, uncomment the following line.
|
47
|
-
#
|
48
|
-
# config.use :slugged
|
49
|
-
#
|
50
|
-
# By default, FriendlyId's :slugged addon expects the slug column to be named
|
51
|
-
# 'slug', but you can change it if you wish.
|
52
|
-
#
|
53
|
-
# config.slug_column = 'slug'
|
54
|
-
#
|
55
|
-
# When FriendlyId can not generate a unique ID from your base method, it appends
|
56
|
-
# a UUID, separated by a single dash. You can configure the character used as the
|
57
|
-
# separator. If you're upgrading from FriendlyId 4, you may wish to replace this
|
58
|
-
# with two dashes.
|
59
|
-
#
|
60
|
-
# config.sequence_separator = '-'
|
61
|
-
#
|
62
|
-
# ## Tips and Tricks
|
63
|
-
#
|
64
|
-
# ### Controlling when slugs are generated
|
65
|
-
#
|
66
|
-
# As of FriendlyId 5.0, new slugs are generated only when the slug field is
|
67
|
-
# nil, but if you're using a column as your base method can change this
|
68
|
-
# behavior by overriding the `should_generate_new_friendly_id` method that
|
69
|
-
# FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
|
70
|
-
# more like 4.0.
|
71
|
-
#
|
72
|
-
# config.use Module.new {
|
73
|
-
# def should_generate_new_friendly_id?
|
74
|
-
# slug.blank? || <your_column_name_here>_changed?
|
75
|
-
# end
|
76
|
-
# }
|
77
|
-
#
|
78
|
-
# FriendlyId uses Rails's `parameterize` method to generate slugs, but for
|
79
|
-
# languages that don't use the Roman alphabet, that's not usually suffient. Here
|
80
|
-
# we use the Babosa library to transliterate Russian Cyrillic slugs to ASCII. If
|
81
|
-
# you use this, don't forget to add "babosa" to your Gemfile.
|
82
|
-
#
|
83
|
-
# config.use Module.new {
|
84
|
-
# def normalize_friendly_id(text)
|
85
|
-
# text.to_slug.normalize! :transliterations => [:russian, :latin]
|
86
|
-
# end
|
87
|
-
# }
|
88
7
|
end
|
data/db/default/spree/roles.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
Spree::Role.where(:
|
2
|
-
Spree::Role.where(:
|
1
|
+
Spree::Role.where(name: "admin").first_or_create
|
2
|
+
Spree::Role.where(name: "user").first_or_create
|
data/db/default/spree/states.rb
CHANGED
@@ -35,7 +35,7 @@ module Spree
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.next_migration_number(dirname)
|
38
|
-
if
|
38
|
+
if ApplicationRecord.timestamped_migrations
|
39
39
|
sleep 1 # make sure to get a different migration every time
|
40
40
|
Time.new.utc.strftime("%Y%m%d%H%M%S")
|
41
41
|
else
|
@@ -30,7 +30,7 @@ module Spree
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
ApplicationController.
|
34
|
-
ApplicationController.
|
33
|
+
ApplicationController.include Spree::AuthenticationHelpers
|
34
|
+
ApplicationController.include Spree::CurrentUserHelpers
|
35
35
|
|
36
|
-
Spree::Api::BaseController.
|
36
|
+
Spree::Api::BaseController.include Spree::CurrentUserHelpers
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class AddSpreeFieldsToCustomUserTable < ActiveRecord::Migration
|
1
|
+
class AddSpreeFieldsToCustomUserTable < ActiveRecord::Migration[4.2]
|
2
2
|
def up
|
3
|
-
add_column <%= table_name.inspect %>, :spree_api_key, :string, :
|
3
|
+
add_column <%= table_name.inspect %>, :spree_api_key, :string, limit: 48
|
4
4
|
add_column <%= table_name.inspect %>, :ship_address_id, :integer
|
5
5
|
add_column <%= table_name.inspect %>, :bill_address_id, :integer
|
6
6
|
end
|
@@ -6,8 +6,8 @@ module Spree
|
|
6
6
|
class DummyGenerator < Rails::Generators::Base
|
7
7
|
desc "Creates blank Rails application, installs Spree and all sample data"
|
8
8
|
|
9
|
-
class_option :lib_name, :
|
10
|
-
class_option :database, :
|
9
|
+
class_option :lib_name, default: ''
|
10
|
+
class_option :database, default: ''
|
11
11
|
|
12
12
|
def self.source_paths
|
13
13
|
paths = self.superclass.source_paths
|
@@ -41,14 +41,14 @@ module Spree
|
|
41
41
|
@lib_name = options[:lib_name]
|
42
42
|
@database = options[:database]
|
43
43
|
|
44
|
-
template "rails/database.yml", "#{dummy_path}/config/database.yml", :
|
45
|
-
template "rails/boot.rb", "#{dummy_path}/config/boot.rb", :
|
46
|
-
template "rails/application.rb", "#{dummy_path}/config/application.rb", :
|
47
|
-
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", :
|
48
|
-
template "rails/test.rb", "#{dummy_path}/config/environments/test.rb", :
|
49
|
-
template "rails/script/rails", "#{dummy_path}/spec/dummy/script/rails", :
|
50
|
-
template "initializers/custom_user.rb", "#{dummy_path}/config/initializers/custom_user.rb", :
|
51
|
-
template "initializers/devise.rb", "#{dummy_path}/config/initializers/devise.rb", :
|
44
|
+
template "rails/database.yml", "#{dummy_path}/config/database.yml", force: true
|
45
|
+
template "rails/boot.rb", "#{dummy_path}/config/boot.rb", force: true
|
46
|
+
template "rails/application.rb", "#{dummy_path}/config/application.rb", force: true
|
47
|
+
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true
|
48
|
+
template "rails/test.rb", "#{dummy_path}/config/environments/test.rb", force: true
|
49
|
+
template "rails/script/rails", "#{dummy_path}/spec/dummy/script/rails", force: true
|
50
|
+
template "initializers/custom_user.rb", "#{dummy_path}/config/initializers/custom_user.rb", force: true
|
51
|
+
template "initializers/devise.rb", "#{dummy_path}/config/initializers/devise.rb", force: true
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_dummy_inject_extension_requirements
|
@@ -91,7 +91,7 @@ begin
|
|
91
91
|
rescue LoadError
|
92
92
|
# #{requirement} is not available.
|
93
93
|
end
|
94
|
-
], :
|
94
|
+
], before: /require '#{@lib_name}'/, verbose: true
|
95
95
|
end
|
96
96
|
|
97
97
|
def dummy_path
|
@@ -1,6 +1,9 @@
|
|
1
1
|
<% if agent_number = ENV['TC_AGENT_NUMBER']
|
2
2
|
database_prefix = agent_number + '_'
|
3
3
|
end %>
|
4
|
+
<% if options[:lib_name]
|
5
|
+
lib_name = options[:lib_name].gsub('/', '_')
|
6
|
+
end %>
|
4
7
|
<% db_password = ENV['DB_PASSWORD'] %>
|
5
8
|
<% db_username = ENV['DB_USERNAME'] %>
|
6
9
|
<% case ENV['DB']
|
@@ -28,13 +31,13 @@ mysql: &mysql
|
|
28
31
|
|
29
32
|
development:
|
30
33
|
<<: *mysql
|
31
|
-
database: <%= database_prefix %><%=
|
34
|
+
database: <%= database_prefix %><%= lib_name %>_spree_development
|
32
35
|
test:
|
33
36
|
<<: *mysql
|
34
|
-
database: <%= database_prefix %><%=
|
37
|
+
database: <%= database_prefix %><%= lib_name %>_spree_test
|
35
38
|
production:
|
36
39
|
<<: *mysql
|
37
|
-
database: <%= database_prefix %><%=
|
40
|
+
database: <%= database_prefix %><%= lib_name %>_spree_production
|
38
41
|
<% when 'postgres' %>
|
39
42
|
<% db_host = ENV['DB_HOST'] %>
|
40
43
|
postgres: &postgres
|
@@ -52,13 +55,13 @@ postgres: &postgres
|
|
52
55
|
|
53
56
|
development:
|
54
57
|
<<: *postgres
|
55
|
-
database: <%= database_prefix %><%=
|
58
|
+
database: <%= database_prefix %><%= lib_name %>_spree_development
|
56
59
|
test:
|
57
60
|
<<: *postgres
|
58
|
-
database: <%= database_prefix %><%=
|
61
|
+
database: <%= database_prefix %><%= lib_name %>_spree_test
|
59
62
|
production:
|
60
63
|
<<: *postgres
|
61
|
-
database: <%= database_prefix %><%=
|
64
|
+
database: <%= database_prefix %><%= lib_name %>_spree_production
|
62
65
|
<% else %>
|
63
66
|
development:
|
64
67
|
adapter: sqlite3
|
@@ -9,7 +9,7 @@ Dummy::Application.configure do
|
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
11
11
|
config.public_file_server.enabled = true
|
12
|
-
config.public_file_server.headers = { 'Cache-Control' =>
|
12
|
+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
13
13
|
|
14
14
|
# Show full error reports and disable caching
|
15
15
|
config.consider_all_requests_local = true
|
@@ -5,15 +5,15 @@ require 'bundler/cli'
|
|
5
5
|
|
6
6
|
module Spree
|
7
7
|
class InstallGenerator < Rails::Generators::Base
|
8
|
-
class_option :migrate, :
|
9
|
-
class_option :seed, :
|
10
|
-
class_option :sample, :
|
11
|
-
class_option :auto_accept, :
|
12
|
-
class_option :user_class, :
|
13
|
-
class_option :admin_email, :
|
14
|
-
class_option :admin_password, :
|
15
|
-
class_option :lib_name, :
|
16
|
-
class_option :enforce_available_locales, :
|
8
|
+
class_option :migrate, type: :boolean, default: true, banner: 'Run Spree migrations'
|
9
|
+
class_option :seed, type: :boolean, default: true, banner: 'load seed data (migrations must be run)'
|
10
|
+
class_option :sample, type: :boolean, default: true, banner: 'load sample data (migrations must be run)'
|
11
|
+
class_option :auto_accept, type: :boolean
|
12
|
+
class_option :user_class, type: :string
|
13
|
+
class_option :admin_email, type: :string
|
14
|
+
class_option :admin_password, type: :string
|
15
|
+
class_option :lib_name, type: :string, default: 'spree'
|
16
|
+
class_option :enforce_available_locales, type: :boolean, default: nil
|
17
17
|
|
18
18
|
def self.source_paths
|
19
19
|
paths = self.superclass.source_paths
|
@@ -172,7 +172,7 @@ Spree::Auth::Engine.load_seed if defined?(Spree::Auth)
|
|
172
172
|
end
|
173
173
|
|
174
174
|
def notify_about_routes
|
175
|
-
insert_into_file File.join('config', 'routes.rb'), :
|
175
|
+
insert_into_file File.join('config', 'routes.rb'), after: "Rails.application.routes.draw do\n" do
|
176
176
|
%Q{
|
177
177
|
# This line mounts Spree's routes at the root of your application.
|
178
178
|
# This means, any requests to URLs such as /products, will go to Spree::ProductsController.
|
@@ -52,7 +52,7 @@ module Spree
|
|
52
52
|
end
|
53
53
|
|
54
54
|
if format_value.is_a?(Proc)
|
55
|
-
options = {action_name.to_sym => {format_name.to_sym => {:
|
55
|
+
options = {action_name.to_sym => {format_name.to_sym => {success: format_value}}}
|
56
56
|
end
|
57
57
|
|
58
58
|
self.spree_responders.deep_merge!(self.name.to_sym => options)
|
@@ -29,7 +29,7 @@ module DelegateBelongsTo
|
|
29
29
|
# @todo Integrate this with ActiveRecord::Dirty, so if you set a property through one of these setters and then call save on this object, it will save the associated object automatically.
|
30
30
|
# delegate_belongs_to :contact
|
31
31
|
# delegate_belongs_to :contact, [:defaults] ## same as above, and useless
|
32
|
-
# delegate_belongs_to :contact, [:defaults, :address, :fullname], :
|
32
|
+
# delegate_belongs_to :contact, [:defaults, :address, :fullname], class_name: 'VCard'
|
33
33
|
##
|
34
34
|
def delegate_belongs_to(association, *attrs)
|
35
35
|
opts = attrs.extract_options!
|
@@ -92,4 +92,4 @@ module DelegateBelongsTo
|
|
92
92
|
protected :delegator_for_setter
|
93
93
|
end
|
94
94
|
|
95
|
-
ActiveRecord::Base.
|
95
|
+
ActiveRecord::Base.include DelegateBelongsTo
|
@@ -7,8 +7,8 @@ module Spree
|
|
7
7
|
def initialize(product, product_params, options = {})
|
8
8
|
@product = product || Spree::Product.new(product_params)
|
9
9
|
|
10
|
-
@product_attrs = product_params
|
11
|
-
@variants_attrs = options[:variants_attrs] || []
|
10
|
+
@product_attrs = product_params.to_h
|
11
|
+
@variants_attrs = (options[:variants_attrs] || []).map(&:to_h)
|
12
12
|
@options_attrs = options[:options_attrs] || []
|
13
13
|
end
|
14
14
|
|
@@ -108,7 +108,7 @@ module Spree
|
|
108
108
|
pp = Spree::ProductProperty.arel_table
|
109
109
|
conds = Hash[*brands.map { |b| [b, pp[:value].eq(b)] }.flatten]
|
110
110
|
{
|
111
|
-
name: '
|
111
|
+
name: I18n.t('spree.taxonomy_brands_name'),
|
112
112
|
scope: :brand_any,
|
113
113
|
conds: conds,
|
114
114
|
labels: (brands.sort).map { |k| [k, k] }
|
data/lib/spree/core/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Spree::BaseController.
|
1
|
+
Spree::BaseController.include Spree::ViewContext
|
@@ -15,6 +15,9 @@ module Spree
|
|
15
15
|
# then replace the locale-specific decimal separator with the standard separator if necessary
|
16
16
|
number.gsub!(separator, '.') unless separator == '.'
|
17
17
|
|
18
|
+
# Returns 0 to avoid ArgumentError: invalid value for BigDecimal(): "" for empty string
|
19
|
+
return 0 unless number.present?
|
20
|
+
|
18
21
|
number.to_d
|
19
22
|
end
|
20
23
|
|
@@ -45,7 +45,7 @@ module Spree
|
|
45
45
|
|
46
46
|
@@image_attributes = [:alt, :attachment, :position, :viewable_type, :viewable_id]
|
47
47
|
|
48
|
-
@@inventory_unit_attributes = [:shipment, :variant_id]
|
48
|
+
@@inventory_unit_attributes = [:shipment, :shipment_id, :variant_id]
|
49
49
|
|
50
50
|
@@line_item_attributes = [:id, :variant_id, :quantity]
|
51
51
|
|
@@ -24,9 +24,9 @@ module Spree
|
|
24
24
|
end
|
25
25
|
|
26
26
|
RSpec.configure do |config|
|
27
|
-
config.include Spree::TestingSupport::Caching, :
|
27
|
+
config.include Spree::TestingSupport::Caching, caching: true
|
28
28
|
|
29
|
-
config.before(:each, :
|
29
|
+
config.before(:each, caching: true) do
|
30
30
|
ActionController::Base.perform_caching = true
|
31
31
|
|
32
32
|
ActiveSupport::Notifications.subscribe("read_fragment.action_controller") do |event, start_time, finish_time, _, details|
|
@@ -40,7 +40,7 @@ RSpec.configure do |config|
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
config.after(:each, :
|
43
|
+
config.after(:each, caching: true) do
|
44
44
|
ActionController::Base.perform_caching = false
|
45
45
|
Rails.cache.clear
|
46
46
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
# require 'spree/testing_support/controller_requests'
|
8
8
|
# RSpec.configure do |c|
|
9
|
-
# c.include Spree::TestingSupport::ControllerRequests, :
|
9
|
+
# c.include Spree::TestingSupport::ControllerRequests, type: :controller
|
10
10
|
# end
|
11
11
|
#
|
12
12
|
# Then, in your controller tests, you can access spree routes like this:
|
@@ -80,13 +80,13 @@ module Spree
|
|
80
80
|
|
81
81
|
def process_spree_action(action, parameters = nil, session = nil, flash = nil, method = "GET")
|
82
82
|
parameters ||= {}
|
83
|
-
process(action, method, parameters, session, flash)
|
83
|
+
process(action, method: method, params: parameters, session: session, flash: flash)
|
84
84
|
end
|
85
85
|
|
86
86
|
def process_spree_xhr_action(action, parameters = nil, session = nil, flash = nil, method = :get)
|
87
87
|
parameters ||= {}
|
88
|
-
parameters.reverse_merge!(:
|
89
|
-
|
88
|
+
parameters.reverse_merge!(format: :json)
|
89
|
+
process(action, method: method, params: parameters, session: session, flash: flash, xhr: true)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Spree
|
2
|
+
module TestingSupport
|
3
|
+
module Kernel
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def silence_stream(stream)
|
8
|
+
old_stream = stream.dup
|
9
|
+
stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
|
10
|
+
stream.sync = true
|
11
|
+
yield
|
12
|
+
ensure
|
13
|
+
stream.reopen(old_stream)
|
14
|
+
old_stream.close
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -13,8 +13,8 @@ class OrderWalkthrough
|
|
13
13
|
# Need to create a valid zone too...
|
14
14
|
zone = FactoryBot.create(:zone)
|
15
15
|
country = FactoryBot.create(:country)
|
16
|
-
zone.members << Spree::ZoneMember.create(:
|
17
|
-
country.states << FactoryBot.create(:state, :
|
16
|
+
zone.members << Spree::ZoneMember.create(zoneable: country)
|
17
|
+
country.states << FactoryBot.create(:state, country: country)
|
18
18
|
|
19
19
|
# A shipping method must exist for rates to be displayed on checkout page
|
20
20
|
unless Spree::ShippingMethod.exists?
|
@@ -45,8 +45,8 @@ class OrderWalkthrough
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def self.address(order)
|
48
|
-
order.bill_address = FactoryBot.create(:address, :
|
49
|
-
order.ship_address = FactoryBot.create(:address, :
|
48
|
+
order.bill_address = FactoryBot.create(:address, country_id: Spree::Zone.global.members.first.zoneable.id)
|
49
|
+
order.ship_address = FactoryBot.create(:address, country_id: Spree::Zone.global.members.first.zoneable.id)
|
50
50
|
order.next!
|
51
51
|
end
|
52
52
|
|
data/lib/tasks/core.rake
CHANGED
@@ -32,7 +32,7 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
|
|
32
32
|
end
|
33
33
|
|
34
34
|
desc "Migrate schema to version 0 and back up again. WARNING: Destroys all data in tables!!"
|
35
|
-
task :
|
35
|
+
task remigrate: :environment do
|
36
36
|
require 'highline/import'
|
37
37
|
|
38
38
|
if ENV['SKIP_NAG'] or ENV['OVERWRITE'].to_s.downcase == 'true' or agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [y/n] ")
|
@@ -101,7 +101,7 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
|
|
101
101
|
|
102
102
|
|
103
103
|
desc "Fix orphan line items after upgrading to Spree 3.1: only needed if you have line items attached to deleted records with Slug (product) and SKU (variant) duplicates of non-deleted records."
|
104
|
-
task :
|
104
|
+
task fix_orphan_line_items: :environment do |t, args|
|
105
105
|
def get_input
|
106
106
|
STDOUT.flush
|
107
107
|
input = STDIN.gets.chomp
|
data/spree_core.gemspec
CHANGED
@@ -3,12 +3,12 @@ require_relative 'lib/spree/core/version.rb'
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
|
-
s.name = '
|
6
|
+
s.name = 'goca-spree-core'
|
7
7
|
s.version = Spree.version
|
8
8
|
s.summary = 'The bare bones necessary for Spree.'
|
9
9
|
s.description = 'The bare bones necessary for Spree.'
|
10
10
|
|
11
|
-
s.required_ruby_version = '>= 2.
|
11
|
+
s.required_ruby_version = '>= 2.2.2'
|
12
12
|
s.required_rubygems_version = '>= 1.8.23'
|
13
13
|
|
14
14
|
s.author = 'Sean Schofield'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goca-spree-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.14.rails.5.0
|
4
|
+
version: 3.1.14.rails.5.0.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: 2025-02-
|
11
|
+
date: 2025-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -369,6 +369,7 @@ files:
|
|
369
369
|
- app/mailers/spree/reimbursement_mailer.rb
|
370
370
|
- app/mailers/spree/shipment_mailer.rb
|
371
371
|
- app/mailers/spree/test_mailer.rb
|
372
|
+
- app/models/application_record.rb
|
372
373
|
- app/models/concerns/spree/adjustment_source.rb
|
373
374
|
- app/models/concerns/spree/calculated_adjustments.rb
|
374
375
|
- app/models/concerns/spree/default_price.rb
|
@@ -925,6 +926,7 @@ files:
|
|
925
926
|
- lib/spree/testing_support/factories/zone_member_factory.rb
|
926
927
|
- lib/spree/testing_support/flash.rb
|
927
928
|
- lib/spree/testing_support/i18n.rb
|
929
|
+
- lib/spree/testing_support/kernel.rb
|
928
930
|
- lib/spree/testing_support/microdata.rb
|
929
931
|
- lib/spree/testing_support/order_walkthrough.rb
|
930
932
|
- lib/spree/testing_support/preferences.rb
|
@@ -956,7 +958,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
956
958
|
requirements:
|
957
959
|
- - ">="
|
958
960
|
- !ruby/object:Gem::Version
|
959
|
-
version: 2.
|
961
|
+
version: 2.2.2
|
960
962
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
961
963
|
requirements:
|
962
964
|
- - ">="
|