spree_core 3.7.14.1 → 4.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/app/controllers/spree/base_controller.rb +0 -1
- data/app/finders/spree/taxons/find.rb +6 -5
- data/app/helpers/spree/base_helper.rb +0 -9
- data/app/helpers/spree/products_helper.rb +1 -1
- data/app/models/concerns/spree/product_scopes.rb +254 -0
- data/app/models/concerns/spree/user_address.rb +5 -2
- data/app/models/friendly_id/slug_decorator.rb +8 -2
- data/app/models/spree/ability.rb +21 -22
- data/app/models/spree/address.rb +37 -24
- data/app/models/spree/adjustment.rb +0 -10
- data/app/models/spree/app_dependencies.rb +2 -2
- data/app/models/spree/asset.rb +1 -12
- data/app/models/spree/country.rb +2 -2
- data/app/models/spree/credit_card.rb +4 -5
- data/app/models/spree/gateway/bogus.rb +1 -1
- data/app/models/spree/image.rb +8 -1
- data/app/models/spree/image/configuration/active_storage.rb +0 -2
- data/app/models/spree/order.rb +13 -78
- data/app/models/spree/order/address_book.rb +86 -0
- data/app/models/spree/order/checkout.rb +4 -22
- data/app/models/spree/order/currency_updater.rb +1 -1
- data/app/models/spree/order/store_credit.rb +0 -18
- data/app/models/spree/order_merger.rb +1 -0
- data/app/models/spree/payment.rb +4 -2
- data/app/models/spree/payment/gateway_options.rb +1 -1
- data/app/models/spree/payment/processing.rb +2 -0
- data/app/models/spree/preferences/configuration.rb +1 -1
- data/app/models/spree/preferences/preferable.rb +1 -1
- data/app/models/spree/product.rb +2 -3
- data/app/models/spree/promotion_handler/coupon.rb +2 -1
- data/app/models/spree/reimbursement_tax_calculator.rb +1 -1
- data/app/models/spree/return_item.rb +1 -1
- data/app/models/spree/return_item/eligibility_validator/default.rb +2 -0
- data/app/models/spree/return_item/eligibility_validator/{rma_required.rb → r_m_a_required.rb} +0 -0
- data/app/models/spree/shipment.rb +1 -1
- data/app/models/spree/store_credit.rb +4 -5
- data/app/models/spree/taxon_image.rb +1 -1
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/services/spree/cart/add_item.rb +3 -1
- data/app/services/spree/cart/update.rb +1 -1
- data/config/locales/en.yml +15 -0
- data/db/default/spree/stores.rb +1 -0
- data/db/default/spree/zones.rb +16 -0
- data/db/migrate/20140806144901_add_type_to_reimbursement_type.rb +1 -1
- data/db/migrate/20141101231208_fix_adjustment_order_presence.rb +2 -2
- data/db/migrate/20170323151450_add_missing_unique_indexes_for_unique_attributes.rb +1 -1
- data/db/migrate/20190305121659_add_iso_and_iso3_validation_on_presence_and_uniqueness.rb +18 -0
- data/db/migrate/20190523092729_add_user_id_and_deleted_at_to_spree_addresses.rb +12 -0
- data/lib/generators/spree/dummy/dummy_generator.rb +3 -1
- data/lib/spree/core.rb +0 -2
- data/lib/spree/core/importer/order.rb +64 -103
- data/lib/spree/core/importer/product.rb +2 -2
- data/lib/spree/core/product_duplicator.rb +1 -5
- data/lib/spree/core/version.rb +1 -3
- data/lib/spree/permitted_attributes.rb +3 -1
- data/lib/spree/testing_support/ability_helpers.rb +3 -11
- data/lib/spree/testing_support/capybara_config.rb +4 -1
- data/lib/spree/testing_support/capybara_ext.rb +22 -98
- data/lib/spree/testing_support/controller_requests.rb +36 -26
- data/lib/spree/testing_support/factories/image_factory.rb +2 -6
- data/lib/spree/testing_support/factories/return_item_factory.rb +2 -2
- data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
- data/lib/spree/testing_support/i18n.rb +6 -8
- data/lib/spree/testing_support/image_helpers.rb +5 -11
- data/lib/tasks/exchanges.rake +35 -37
- data/spree_core.gemspec +11 -14
- metadata +63 -103
- data/app/models/concerns/spree/acts_as_taggable.rb +0 -11
- data/app/models/spree/image/configuration/paperclip.rb +0 -64
- data/app/models/spree/order_contents.rb +0 -54
- data/app/models/spree/product/scopes.rb +0 -250
- data/app/models/spree/tag.rb +0 -4
- data/app/models/spree/taxon_image/configuration/paperclip.rb +0 -27
- data/config/initializers/acts_as_taggable_on.rb +0 -9
- data/config/initializers/use_paperclip.rb +0 -3
- data/db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb +0 -40
- data/db/migrate/20160511072249_change_collation_for_spree_tag_names.rb +0 -9
- data/db/migrate/20160511072335_add_missing_indexes_to_spree_taggings.rb +0 -14
- data/lib/spree/core/controller_helpers/respond_with.rb +0 -67
- data/lib/spree/responder.rb +0 -44
- data/lib/spree/testing_support/factories/tag_factory.rb +0 -5
@@ -26,11 +26,11 @@ module Spree
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def update
|
29
|
-
if product.
|
29
|
+
if product.update(product_attrs)
|
30
30
|
variants_attrs.each do |variant_attribute|
|
31
31
|
# update the variant if the id is present in the payload
|
32
32
|
if variant_attribute['id'].present?
|
33
|
-
product.variants.find(variant_attribute['id'].to_i).
|
33
|
+
product.variants.find(variant_attribute['id'].to_i).update(variant_attribute)
|
34
34
|
else
|
35
35
|
# make sure the product is assigned before the options=
|
36
36
|
product.variants.create({ product: product }.merge(variant_attribute))
|
@@ -58,11 +58,7 @@ module Spree
|
|
58
58
|
|
59
59
|
def duplicate_image(image)
|
60
60
|
new_image = image.dup
|
61
|
-
|
62
|
-
new_image.assign_attributes(attachment: image.attachment.clone)
|
63
|
-
else
|
64
|
-
new_image.attachment.attach(image.attachment.blob)
|
65
|
-
end
|
61
|
+
new_image.attachment.attach(image.attachment.blob)
|
66
62
|
new_image.save!
|
67
63
|
new_image
|
68
64
|
end
|
data/lib/spree/core/version.rb
CHANGED
@@ -33,12 +33,14 @@ module Spree
|
|
33
33
|
:id, :firstname, :lastname, :first_name, :last_name,
|
34
34
|
:address1, :address2, :city, :country_iso, :country_id, :state_id,
|
35
35
|
:zipcode, :phone, :state_name, :alternative_phone, :company,
|
36
|
+
:user_id, :deleted_at,
|
36
37
|
country: [:iso, :name, :iso3, :iso_name],
|
37
38
|
state: [:name, :abbr]
|
38
39
|
]
|
39
40
|
|
40
41
|
@@checkout_attributes = [
|
41
|
-
:coupon_code, :email, :shipping_method_id, :special_instructions, :use_billing,
|
42
|
+
:coupon_code, :email, :shipping_method_id, :special_instructions, :use_billing,
|
43
|
+
:user_id, :bill_address_id, :ship_address_id
|
42
44
|
]
|
43
45
|
|
44
46
|
@@customer_return_attributes = [:stock_location_id, return_items_attributes: [:id, :inventory_unit_id, :return_authorization_id, :returned, :pre_tax_amount, :acceptance_status, :exchange_variant_id, :resellable]]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
shared_examples_for 'access granted' do
|
2
|
-
it 'should allow
|
3
|
-
expect(ability).to be_able_to(:
|
4
|
-
expect(ability).to be_able_to(:
|
2
|
+
it 'should allow show' do
|
3
|
+
expect(ability).to be_able_to(:show, resource, token) if token
|
4
|
+
expect(ability).to be_able_to(:show, resource) unless token
|
5
5
|
end
|
6
6
|
|
7
7
|
it 'should allow create' do
|
@@ -66,10 +66,6 @@ shared_examples_for 'create only' do
|
|
66
66
|
it 'should not allow update' do
|
67
67
|
expect(ability).to_not be_able_to(:update, resource)
|
68
68
|
end
|
69
|
-
|
70
|
-
it 'should not allow index' do
|
71
|
-
expect(ability).to_not be_able_to(:index, resource)
|
72
|
-
end
|
73
69
|
end
|
74
70
|
|
75
71
|
shared_examples_for 'read only' do
|
@@ -98,8 +94,4 @@ shared_examples_for 'update only' do
|
|
98
94
|
it 'should allow update' do
|
99
95
|
expect(ability).to be_able_to(:update, resource)
|
100
96
|
end
|
101
|
-
|
102
|
-
it 'should not allow index' do
|
103
|
-
expect(ability).to_not be_able_to(:index, resource)
|
104
|
-
end
|
105
97
|
end
|
@@ -7,10 +7,12 @@ if ENV['WEBDRIVER'] == 'accessible'
|
|
7
7
|
Capybara.javascript_driver = :accessible
|
8
8
|
else
|
9
9
|
Capybara.register_driver :chrome do |app|
|
10
|
+
Selenium::WebDriver.logger.level = :error
|
11
|
+
|
10
12
|
Capybara::Selenium::Driver.new app,
|
11
13
|
browser: :chrome,
|
12
14
|
options: Selenium::WebDriver::Chrome::Options.new(
|
13
|
-
args: %w[disable-popup-blocking headless disable-gpu window-size=1920,1080],
|
15
|
+
args: %w[no-sandbox disable-dev-shm-usage disable-popup-blocking headless disable-gpu window-size=1920,1080 --enable-features=NetworkService,NetworkServiceInProcess --disable-features=VizDisplayCompositor],
|
14
16
|
log_level: :error
|
15
17
|
)
|
16
18
|
end
|
@@ -21,3 +23,4 @@ else
|
|
21
23
|
end
|
22
24
|
end
|
23
25
|
Capybara.default_max_wait_time = 45
|
26
|
+
Capybara.server = :webrick
|
@@ -1,7 +1,11 @@
|
|
1
1
|
module CapybaraExt
|
2
2
|
# https://bugs.chromium.org/p/chromedriver/issues/detail?id=1771
|
3
|
-
def
|
4
|
-
|
3
|
+
def delayed_fill_in(selector, text)
|
4
|
+
field = find_field(selector)
|
5
|
+
text.to_s.split('').each do |char|
|
6
|
+
sleep 0.05
|
7
|
+
field.send_keys(char)
|
8
|
+
end
|
5
9
|
end
|
6
10
|
|
7
11
|
def page!
|
@@ -9,19 +13,14 @@ module CapybaraExt
|
|
9
13
|
end
|
10
14
|
|
11
15
|
def click_icon(type)
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def eventually_fill_in(field, options = {})
|
16
|
-
expect(page).to have_css('#' + field)
|
17
|
-
fill_in field, options
|
16
|
+
first(".icon-#{type}").click
|
18
17
|
end
|
19
18
|
|
20
19
|
def within_row(num, &block)
|
21
20
|
if RSpec.current_example.metadata[:js]
|
22
|
-
within("table.table tbody tr:nth-child(#{num})", &block)
|
21
|
+
within("table.table tbody tr:nth-child(#{num})", match: :first, &block)
|
23
22
|
else
|
24
|
-
within(
|
23
|
+
within(all('table.table tbody tr')[num - 1], &block)
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
@@ -33,31 +32,29 @@ module CapybaraExt
|
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
36
|
-
def set_select2_field(field, value)
|
37
|
-
page.execute_script %Q{$('#{field}').select2('val', '#{value}')}
|
38
|
-
end
|
39
|
-
|
40
35
|
def select2_search(value, options)
|
41
|
-
|
42
|
-
within label.first(:xpath, './/..') do
|
43
|
-
options[:from] = "##{find('.select2-container')['id']}"
|
44
|
-
end
|
36
|
+
options[:from] = select2_from_label(options[:from])
|
45
37
|
targetted_select2_search(value, options)
|
46
38
|
end
|
47
39
|
|
48
40
|
def targetted_select2_search(value, options)
|
49
|
-
|
50
|
-
|
41
|
+
select2_el = find(:css, options[:from])
|
42
|
+
select2_el.click
|
43
|
+
page.document.find('.select2-search input.select2-input,
|
44
|
+
.select2-search-field input.select2-input.select2-focused').send_keys(value)
|
51
45
|
select_select2_result(value)
|
52
46
|
end
|
53
47
|
|
54
48
|
def select2(value, options)
|
55
|
-
|
49
|
+
options[:from] = select2_from_label(options[:from])
|
50
|
+
targetted_select2(value, options)
|
51
|
+
end
|
56
52
|
|
53
|
+
def select2_from_label(from)
|
54
|
+
label = find(:label, from, class: '!select2-offscreen')
|
57
55
|
within label.first(:xpath, './/..') do
|
58
|
-
|
56
|
+
"##{find('.select2-container')['id']}"
|
59
57
|
end
|
60
|
-
targetted_select2(value, options)
|
61
58
|
end
|
62
59
|
|
63
60
|
def select2_no_label(value, options = {})
|
@@ -77,29 +74,7 @@ module CapybaraExt
|
|
77
74
|
|
78
75
|
def select_select2_result(value)
|
79
76
|
# results are in a div appended to the end of the document
|
80
|
-
|
81
|
-
page.find('div.select2-result-label', text: %r{#{Regexp.escape(value)}}i).click
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def find_label_by_text(text)
|
86
|
-
label = find_label(text)
|
87
|
-
counter = 0
|
88
|
-
|
89
|
-
# Because JavaScript testing is prone to errors...
|
90
|
-
while label.nil? && counter < 10
|
91
|
-
sleep(1)
|
92
|
-
counter += 1
|
93
|
-
label = find_label(text)
|
94
|
-
end
|
95
|
-
|
96
|
-
raise "Could not find label by text #{text}" if label.nil?
|
97
|
-
|
98
|
-
label
|
99
|
-
end
|
100
|
-
|
101
|
-
def find_label(text)
|
102
|
-
first(:xpath, "//label[text()[contains(.,'#{text}')]]")
|
77
|
+
page.document.find('div.select2-result-label', match: :first, text: %r{#{Regexp.escape(value)}}i).click
|
103
78
|
end
|
104
79
|
|
105
80
|
# arg delay in seconds
|
@@ -110,11 +85,6 @@ module CapybaraExt
|
|
110
85
|
end
|
111
86
|
end
|
112
87
|
|
113
|
-
# "Intelligiently" wait on condition
|
114
|
-
#
|
115
|
-
# Much better than a random sleep "here and there"
|
116
|
-
# it will not cause any delay in case the condition is fullfilled on first cycle.
|
117
|
-
|
118
88
|
def wait_for_condition(delay = Capybara.default_max_wait_time)
|
119
89
|
counter = 0
|
120
90
|
delay_threshold = delay * 10
|
@@ -125,40 +95,9 @@ module CapybaraExt
|
|
125
95
|
end
|
126
96
|
end
|
127
97
|
|
128
|
-
def dismiss_alert
|
129
|
-
page.evaluate_script('window.confirm = function() { return false; }')
|
130
|
-
yield
|
131
|
-
# Restore existing default
|
132
|
-
page.evaluate_script('window.confirm = function() { return true; }')
|
133
|
-
end
|
134
|
-
|
135
|
-
def spree_accept_alert
|
136
|
-
yield
|
137
|
-
rescue Selenium::WebDriver::Error::UnhandledAlertError, Selenium::WebDriver::Error::NoSuchAlertError
|
138
|
-
Selenium::WebDriver::Wait.new(timeout: 5)
|
139
|
-
.until { page.driver.browser.switch_to.alert }
|
140
|
-
.accept
|
141
|
-
end
|
142
|
-
|
143
98
|
def disable_html5_validation
|
144
99
|
page.execute_script('for(var f=document.forms,i=f.length;i--;)f[i].setAttribute("novalidate",i)')
|
145
100
|
end
|
146
|
-
|
147
|
-
def handle_js_confirm(accept = true)
|
148
|
-
page.evaluate_script 'window.original_confirm_function = window.confirm'
|
149
|
-
page.evaluate_script "window.confirm = function(msg) { return #{accept}; }"
|
150
|
-
yield
|
151
|
-
ensure
|
152
|
-
page.evaluate_script 'window.confirm = window.original_confirm_function'
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def wait_for(options = {})
|
157
|
-
default_options = { error: nil, seconds: 5 }.merge(options)
|
158
|
-
|
159
|
-
Selenium::WebDriver::Wait.new(timeout: default_options[:seconds]).until { yield }
|
160
|
-
rescue Selenium::WebDriver::Error::TimeOutError
|
161
|
-
default_options[:error].nil? ? false : raise(default_options[:error])
|
162
101
|
end
|
163
102
|
|
164
103
|
def wait_for(options = {})
|
@@ -170,7 +109,7 @@ rescue Selenium::WebDriver::Error::TimeOutError
|
|
170
109
|
end
|
171
110
|
|
172
111
|
Capybara.configure do |config|
|
173
|
-
config.match = :
|
112
|
+
config.match = :smart
|
174
113
|
config.ignore_hidden_elements = true
|
175
114
|
end
|
176
115
|
|
@@ -189,21 +128,6 @@ RSpec::Matchers.define :have_meta do |name, expected|
|
|
189
128
|
end
|
190
129
|
end
|
191
130
|
|
192
|
-
RSpec::Matchers.define :have_title do |expected|
|
193
|
-
match do |_actual|
|
194
|
-
has_css?('title', text: expected, visible: false)
|
195
|
-
end
|
196
|
-
|
197
|
-
failure_message do |actual|
|
198
|
-
actual = first('title')
|
199
|
-
if actual
|
200
|
-
"expected that title would have been '#{expected}' but was '#{actual.text}'"
|
201
|
-
else
|
202
|
-
"expected that title would exist with '#{expected}'"
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
131
|
RSpec.configure do |c|
|
208
132
|
c.include CapybaraExt
|
209
133
|
end
|
@@ -1,28 +1,3 @@
|
|
1
|
-
# Use this module to easily test Spree actions within Spree components
|
2
|
-
# or inside your application to test routes for the mounted Spree engine.
|
3
|
-
#
|
4
|
-
# Inside your spec_helper.rb, include this module inside the RSpec.configure
|
5
|
-
# block by doing this:
|
6
|
-
#
|
7
|
-
# require 'spree/testing_support/controller_requests'
|
8
|
-
# RSpec.configure do |c|
|
9
|
-
# c.include Spree::TestingSupport::ControllerRequests, type: :controller
|
10
|
-
# end
|
11
|
-
#
|
12
|
-
# Then, in your controller tests, you can access spree routes like this:
|
13
|
-
#
|
14
|
-
# require 'spec_helper'
|
15
|
-
#
|
16
|
-
# describe Spree::ProductsController do
|
17
|
-
# it "can see all the products" do
|
18
|
-
# spree_get :index
|
19
|
-
# end
|
20
|
-
# end
|
21
|
-
#
|
22
|
-
# Use spree_get, spree_post, spree_put or spree_delete to make requests
|
23
|
-
# to the Spree engine, and use regular get, post, put or delete to make
|
24
|
-
# requests to your application.
|
25
|
-
#
|
26
1
|
module Spree
|
27
2
|
module TestingSupport
|
28
3
|
module ControllerRequests
|
@@ -33,46 +8,81 @@ module Spree
|
|
33
8
|
end
|
34
9
|
|
35
10
|
def spree_get(action, parameters = nil, session = nil, flash = nil)
|
11
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
12
|
+
ControllerRequests#spree_get is deprecated and will be removed in Spree 4.1.
|
13
|
+
Please use get, params: {}
|
14
|
+
DEPRECATION
|
36
15
|
process_spree_action(action, parameters, session, flash, 'GET')
|
37
16
|
end
|
38
17
|
|
39
18
|
# Executes a request simulating POST HTTP method and set/volley the response
|
40
19
|
def spree_post(action, parameters = nil, session = nil, flash = nil)
|
20
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
21
|
+
ControllerRequests#spree_post is deprecated and will be removed in Spree 4.1.
|
22
|
+
Please use post, params: {}
|
23
|
+
DEPRECATION
|
41
24
|
process_spree_action(action, parameters, session, flash, 'POST')
|
42
25
|
end
|
43
26
|
|
44
27
|
# Executes a request simulating PUT HTTP method and set/volley the response
|
45
28
|
def spree_put(action, parameters = nil, session = nil, flash = nil)
|
29
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
30
|
+
ControllerRequests#spree_put is deprecated and will be removed in Spree 4.1.
|
31
|
+
Please use put, params: {}
|
32
|
+
DEPRECATION
|
46
33
|
process_spree_action(action, parameters, session, flash, 'PUT')
|
47
34
|
end
|
48
35
|
|
49
|
-
# Executes a request simulating PATCH HTTP method and set/volley the response
|
36
|
+
# # Executes a request simulating PATCH HTTP method and set/volley the response
|
50
37
|
def spree_patch(action, parameters = nil, session = nil, flash = nil)
|
38
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
39
|
+
ControllerRequests#spree_patch is deprecated and will be removed in Spree 4.1.
|
40
|
+
Please use patch, params: {}
|
41
|
+
DEPRECATION
|
51
42
|
process_spree_action(action, parameters, session, flash, 'PATCH')
|
52
43
|
end
|
53
44
|
|
54
45
|
# Executes a request simulating DELETE HTTP method and set/volley the response
|
55
46
|
def spree_delete(action, parameters = nil, session = nil, flash = nil)
|
47
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
48
|
+
ControllerRequests#spree_delete is deprecated and will be removed in Spree 4.1.
|
49
|
+
Please use delete, params: {}
|
50
|
+
DEPRECATION
|
56
51
|
process_spree_action(action, parameters, session, flash, 'DELETE')
|
57
52
|
end
|
58
53
|
|
59
54
|
def spree_xhr_get(action, parameters = nil, session = nil, flash = nil)
|
55
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
56
|
+
ControllerRequests#spree_xhr_get is deprecated and will be removed in Spree 4.1.
|
57
|
+
DEPRECATION
|
60
58
|
process_spree_xhr_action(action, parameters, session, flash, :get)
|
61
59
|
end
|
62
60
|
|
63
61
|
def spree_xhr_post(action, parameters = nil, session = nil, flash = nil)
|
62
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
63
|
+
ControllerRequests#spree_xhr_post is deprecated and will be removed in Spree 4.1.
|
64
|
+
DEPRECATION
|
64
65
|
process_spree_xhr_action(action, parameters, session, flash, :post)
|
65
66
|
end
|
66
67
|
|
67
68
|
def spree_xhr_put(action, parameters = nil, session = nil, flash = nil)
|
69
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
70
|
+
ControllerRequests#spree_xhr_put is deprecated and will be removed in Spree 4.1.
|
71
|
+
DEPRECATION
|
68
72
|
process_spree_xhr_action(action, parameters, session, flash, :put)
|
69
73
|
end
|
70
74
|
|
71
75
|
def spree_xhr_patch(action, parameters = nil, session = nil, flash = nil)
|
76
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
77
|
+
ControllerRequests#spree_xhr_patch is deprecated and will be removed in Spree 4.1.
|
78
|
+
DEPRECATION
|
72
79
|
process_spree_xhr_action(action, parameters, session, flash, :patch)
|
73
80
|
end
|
74
81
|
|
75
82
|
def spree_xhr_delete(action, parameters = nil, session = nil, flash = nil)
|
83
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
84
|
+
ControllerRequests#spree_xhr_delete is deprecated and will be removed in Spree 4.1.
|
85
|
+
DEPRECATION
|
76
86
|
process_spree_xhr_action(action, parameters, session, flash, :delete)
|
77
87
|
end
|
78
88
|
|
@@ -1,11 +1,7 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :image, class: Spree::Image do
|
3
|
-
|
4
|
-
attachment
|
5
|
-
else
|
6
|
-
before(:create) do |image|
|
7
|
-
image.attachment.attach(io: File.new(Spree::Core::Engine.root + 'spec/fixtures' + 'thinking-cat.jpg'), filename: 'thinking-cat.jpg')
|
8
|
-
end
|
3
|
+
before(:create) do |image|
|
4
|
+
image.attachment.attach(io: File.new(Spree::Core::Engine.root + 'spec/fixtures' + 'thinking-cat.jpg'), filename: 'thinking-cat.jpg')
|
9
5
|
end
|
10
6
|
end
|
11
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :return_item, class: Spree::ReturnItem do
|
3
|
-
association(:inventory_unit, factory: :inventory_unit, state: :shipped)
|
4
|
-
association(:return_authorization, factory: :return_authorization)
|
3
|
+
association(:inventory_unit, factory: :inventory_unit, state: :shipped, strategy: :create)
|
4
|
+
association(:return_authorization, factory: :return_authorization, strategy: :create)
|
5
5
|
|
6
6
|
factory :exchange_return_item do
|
7
7
|
after(:build) do |return_item|
|
@@ -32,14 +32,12 @@ module Spree
|
|
32
32
|
root = translations
|
33
33
|
processed_keys = []
|
34
34
|
translation_keys.each do |key|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
Spree.missing_translation_messages << error
|
42
|
-
end
|
35
|
+
root = root.fetch(key.to_sym)
|
36
|
+
processed_keys << key.to_sym
|
37
|
+
rescue KeyError
|
38
|
+
error = "#{(processed_keys << key).join('.')} (#{I18n.locale})"
|
39
|
+
unless Spree.missing_translation_messages.include?(error)
|
40
|
+
Spree.missing_translation_messages << error
|
43
41
|
end
|
44
42
|
end
|
45
43
|
end
|