solidus_frontend 2.9.6 → 2.10.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_frontend might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59a3b04e427501e6c465c89d3a7a5278be8b999ab29dbbe0af9841df1d1032c8
4
- data.tar.gz: f62b17d100120614790bf81f0f0f202f1b55918489b242f8b89cb311406f96a2
3
+ metadata.gz: 310fa3a7c2ffb353cad6a3c0079333d95c073943e0abc47fab729f5540adc33d
4
+ data.tar.gz: 450b021d8e2016edcc7b0a0a219437077a41e9d0336cef670ddbf5ab1cdea3d6
5
5
  SHA512:
6
- metadata.gz: 7385f7eb310a92fcb4eaf18b2fd377cf08ee0c863bd806724dd860ad70d99dceadb59807edf6dcd6b8d2608a12e1064f301c912664d44616c235f6ac79e6ec6e
7
- data.tar.gz: dda5bfdd5c4c33f6bbdda2692d24a24ec0953686c4ebfec47137451fd830a7a36e884b1577fef5a24f03c0007f95401820c6118ac38e2ed6452215f449d22454
6
+ metadata.gz: dd6a633f4cb60280996525a0baf5dfeb26de2a8b6b09ccd8764b3ae875a6f7ed1ce9042de398fe71e55f86b5e5a8fb7eec451e830d04f907409227651eeb23fa
7
+ data.tar.gz: d58fb10140bcef216ae59b79ce1cb53237c7d8b19556dc5dc7cde72fa36d0bc7d37ad8815cc7b7c595145447f66f9d9cef5b0b6b23b8d3a84e39b71eb482f1b5
@@ -17,7 +17,7 @@ module Spree
17
17
 
18
18
  before_action :associate_user
19
19
  before_action :check_authorization
20
- before_action :apply_coupon_code, only: [:update]
20
+ before_action :apply_coupon_code
21
21
 
22
22
  before_action :setup_for_current_state, only: [:edit, :update]
23
23
 
@@ -87,23 +87,11 @@ module Spree
87
87
  end
88
88
 
89
89
  def update_params
90
- case params[:state].to_sym
91
- when :address
92
- massaged_params.require(:order).permit(
93
- permitted_checkout_address_attributes
94
- )
95
- when :delivery
96
- massaged_params.require(:order).permit(
97
- permitted_checkout_delivery_attributes
98
- )
99
- when :payment
100
- massaged_params.require(:order).permit(
101
- permitted_checkout_payment_attributes
102
- )
90
+ if update_params = massaged_params[:order]
91
+ update_params.permit(permitted_checkout_attributes)
103
92
  else
104
- massaged_params.fetch(:order, {}).permit(
105
- permitted_checkout_confirm_attributes
106
- )
93
+ # We currently allow update requests without any parameters in them.
94
+ {}
107
95
  end
108
96
  end
109
97
 
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spree/frontend_configuration'
4
+
5
+ module Spree
6
+ module Frontend
7
+ Config = Spree::FrontendConfiguration.new
8
+ end
9
+ end
@@ -1,13 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'spree/frontend/config'
4
+
3
5
  module Spree
4
6
  module Frontend
5
7
  class Engine < ::Rails::Engine
6
8
  config.middleware.use "Spree::Frontend::Middleware::SeoAssist"
7
9
 
8
- initializer "spree.frontend.environment", before: :load_config_initializers do |_app|
9
- Spree::Frontend::Config = Spree::FrontendConfiguration.new
10
- end
10
+ # Leave initializer empty for backwards-compatability. Other apps
11
+ # might still rely on this event.
12
+ initializer "spree.frontend.environment", before: :load_config_initializers do; end
11
13
  end
12
14
  end
13
15
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Spree
4
4
  class FrontendConfiguration < Preferences::Configuration
5
- preference :locale, :string, default: Rails.application.config.i18n.default_locale
5
+ preference :locale, :string, default: I18n.default_locale
6
6
 
7
7
  # Add your terms and conditions in app/views/spree/checkout/_terms_and_conditions.en.html.erb
8
8
  preference :require_terms_and_conditions_acceptance, :boolean, default: false
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.add_dependency 'font-awesome-rails', '~> 4.0'
29
29
  s.add_dependency 'jquery-rails'
30
30
  s.add_dependency 'kaminari', '~> 1.1'
31
+ s.add_dependency 'responders'
31
32
  s.add_dependency 'sassc-rails'
32
33
  s.add_dependency 'truncate_html', '~> 0.9', '>= 0.9.2'
33
34
 
@@ -68,7 +68,7 @@ describe Spree::CheckoutController, type: :controller do
68
68
  it 'should check if the user is authorized for :edit' do
69
69
  expect(controller).to receive(:authorize!).with(:edit, order, token)
70
70
  request.cookie_jar.signed[:guest_token] = token
71
- post :update, params: { state: 'address', order: { bill_address_attributes: address_params } }
71
+ post :update, params: { state: 'address' }
72
72
  end
73
73
 
74
74
  context "save successful" do
@@ -91,12 +91,12 @@ describe Spree::CheckoutController, type: :controller do
91
91
 
92
92
  context "with the order in the cart state", partial_double_verification: false do
93
93
  before do
94
- order.update_attributes! user: user
94
+ order.update! user: user
95
95
  order.update_column(:state, "cart")
96
96
  end
97
97
 
98
98
  it "should assign order" do
99
- post :update, params: { state: "address", order: { bill_address_attributes: address_params } }
99
+ post :update, params: { state: "address" }
100
100
  expect(assigns[:order]).not_to be_nil
101
101
  end
102
102
 
@@ -140,7 +140,7 @@ describe Spree::CheckoutController, type: :controller do
140
140
 
141
141
  context "with the order in the address state", partial_double_verification: false do
142
142
  before do
143
- order.update_attributes! user: user
143
+ order.update! user: user
144
144
  order.update_columns(ship_address_id: create(:address).id, state: "address")
145
145
  end
146
146
 
@@ -213,7 +213,7 @@ describe Spree::CheckoutController, type: :controller do
213
213
  end
214
214
 
215
215
  before do
216
- order.update_attributes! user: user
216
+ order.update! user: user
217
217
  3.times { order.next! } # should put us in the payment state
218
218
  end
219
219
 
@@ -245,7 +245,7 @@ describe Spree::CheckoutController, type: :controller do
245
245
  end
246
246
 
247
247
  before do
248
- order.update_attributes! user: user
248
+ order.update! user: user
249
249
  3.times { order.next! } # should put us in the payment state
250
250
  end
251
251
 
@@ -271,36 +271,11 @@ describe Spree::CheckoutController, type: :controller do
271
271
  expect(order.payments).to be_empty
272
272
  end
273
273
  end
274
-
275
- context 'trying to change the address' do
276
- let(:params) do
277
- {
278
- state: 'payment',
279
- order: {
280
- payments_attributes: [
281
- {
282
- payment_method_id: payment_method.id.to_s,
283
- source_attributes: attributes_for(:credit_card)
284
- }
285
- ],
286
- ship_address_attributes: {
287
- zipcode: 'TEST'
288
- }
289
- }
290
- }
291
- end
292
-
293
- it 'does not change the address' do
294
- expect do
295
- post :update, params: params
296
- end.not_to change { order.reload.ship_address.zipcode }
297
- end
298
- end
299
274
  end
300
275
 
301
276
  context "when in the confirm state" do
302
277
  before do
303
- order.update_attributes! user: user
278
+ order.update! user: user
304
279
  order.update_column(:state, "confirm")
305
280
  # An order requires a payment to reach the complete state
306
281
  # This is because payment_required? is true on the order
@@ -330,23 +305,21 @@ describe Spree::CheckoutController, type: :controller do
330
305
 
331
306
  context "save unsuccessful" do
332
307
  before do
333
- order.update_attributes! user: user
308
+ order.update! user: user
334
309
  allow(order).to receive_messages valid?: false
335
310
  end
336
311
 
337
312
  it "should not assign order" do
338
- post :update, params: { state: "address", order: { email: ''} }
313
+ post :update, params: { state: "address", email: '' }
339
314
  expect(assigns[:order]).not_to be_nil
340
315
  end
341
316
 
342
317
  it "should not change the order state" do
343
- expect do
344
- post :update, params: { state: 'address', order: { bill_address_attributes: address_params } }
345
- end.not_to change { order.reload.state }
318
+ post :update, params: { state: 'address' }
346
319
  end
347
320
 
348
321
  it "should render the edit template" do
349
- post :update, params: { state: 'address', order: { bill_address_attributes: address_params } }
322
+ post :update, params: { state: 'address' }
350
323
  expect(response).to render_template :edit
351
324
  end
352
325
  end
@@ -367,9 +340,9 @@ describe Spree::CheckoutController, type: :controller do
367
340
 
368
341
  context "Spree::Core::GatewayError" do
369
342
  before do
370
- order.update_attributes! user: user
343
+ order.update! user: user
371
344
  allow(order).to receive(:next).and_raise(Spree::Core::GatewayError.new("Invalid something or other."))
372
- post :update, params: { state: "address", order: { bill_address_attributes: address_params } }
345
+ post :update, params: { state: "address" }
373
346
  end
374
347
 
375
348
  it "should render the edit template and display exception message" do
@@ -400,7 +373,7 @@ describe Spree::CheckoutController, type: :controller do
400
373
  end
401
374
 
402
375
  it "due to the order having errors" do
403
- put :update, params: { state: order.state, order: { bill_address_attributes: address_params } }
376
+ put :update, params: { state: order.state, order: {} }
404
377
  expect(flash[:error]).to eq("Base error\nAdjustments error")
405
378
  expect(response).to redirect_to(spree.checkout_state_path('address'))
406
379
  end
@@ -414,7 +387,7 @@ describe Spree::CheckoutController, type: :controller do
414
387
  end
415
388
 
416
389
  it "due to no available shipping rates for any of the shipments" do
417
- put :update, params: { state: "address", order: { bill_address_attributes: address_params } }
390
+ put :update, params: { state: "address", order: {} }
418
391
  expect(flash[:error]).to eq(I18n.t('spree.items_cannot_be_shipped'))
419
392
  expect(response).to redirect_to(spree.checkout_state_path('address'))
420
393
  end
@@ -464,7 +437,7 @@ describe Spree::CheckoutController, type: :controller do
464
437
  end
465
438
 
466
439
  it "redirects the customer to the cart page with an error message" do
467
- put :update, params: { state: order.state, order: { bill_address_attributes: address_params } }
440
+ put :update, params: { state: order.state, order: {} }
468
441
  expect(flash[:error]).to eq(I18n.t('spree.insufficient_stock_for_order'))
469
442
  expect(response).to redirect_to(spree.cart_path)
470
443
  end
@@ -521,11 +494,9 @@ describe Spree::CheckoutController, type: :controller do
521
494
  allow(controller).to receive_messages check_authorization: true
522
495
  end
523
496
 
524
- # This does not test whether the shipping address is set via params.
525
- # It only tests whether it is set in the before action.
526
- it "doesn't set a default shipping address on the order" do
497
+ it "doesn't set shipping address on the order" do
527
498
  expect(order).to_not receive(:ship_address=)
528
- post :update, params: { state: order.state, order: { bill_address_attributes: address_params } }
499
+ post :update, params: { state: order.state }
529
500
  end
530
501
 
531
502
  it "doesn't remove unshippable items before payment" do
@@ -540,7 +511,7 @@ describe Spree::CheckoutController, type: :controller do
540
511
  allow(controller).to receive_messages check_authorization: true
541
512
 
542
513
  expect {
543
- post :update, params: { state: "payment", order: { email: "johndoe@example.com"} }
514
+ post :update, params: { state: "payment" }
544
515
  }.to change { order.line_items.to_a.size }.from(1).to(0)
545
516
  end
546
517
 
@@ -37,7 +37,7 @@ module Spree
37
37
 
38
38
  context '#update' do
39
39
  it 'should check if user is authorized for :update' do
40
- allow(order).to receive :update_attributes
40
+ allow(order).to receive :update
41
41
  expect(controller).to receive(:authorize!).with(:update, order, token)
42
42
  post :update, params: { order: { email: "foo@bar.com" }, token: token }
43
43
  end
@@ -117,13 +117,13 @@ describe Spree::OrdersController, type: :controller do
117
117
  end
118
118
 
119
119
  it "should redirect to cart path (on success)" do
120
- allow(order).to receive(:update_attributes).and_return true
120
+ allow(order).to receive(:update).and_return true
121
121
  put :update
122
122
  expect(response).to redirect_to(spree.cart_path)
123
123
  end
124
124
 
125
125
  it "should advance the order if :checkout button is pressed" do
126
- allow(order).to receive(:update_attributes).and_return true
126
+ allow(order).to receive(:update).and_return true
127
127
  expect(order).to receive(:next)
128
128
  put :update, params: { checkout: true }
129
129
  expect(response).to redirect_to checkout_state_path('address')
@@ -374,14 +374,6 @@ describe "Checkout", type: :feature, inaccessible: true do
374
374
  expect(page).to have_current_path(spree.order_path(Spree::Order.last))
375
375
  expect(page).to have_content('Ending in 1111')
376
376
  end
377
-
378
- it "allows user to save a billing address associated to the credit card" do
379
- choose "use_existing_card_no"
380
- fill_in_credit_card
381
-
382
- click_on "Save and Continue"
383
- expect(Spree::CreditCard.last.address).to be_present
384
- end
385
377
  end
386
378
 
387
379
  # regression for https://github.com/spree/spree/issues/2921
@@ -51,20 +51,20 @@ describe "Visiting Products", type: :feature, inaccessible: true do
51
51
  end
52
52
 
53
53
  it 'displays metas' do
54
- jersey.update_attributes metas
54
+ jersey.update metas
55
55
  click_link jersey.name
56
56
  expect(page).to have_meta(:description, 'Brand new Ruby on Rails Jersey')
57
57
  expect(page).to have_meta(:keywords, 'ror, jersey, ruby')
58
58
  end
59
59
 
60
60
  it 'displays title if set' do
61
- jersey.update_attributes metas
61
+ jersey.update metas
62
62
  click_link jersey.name
63
63
  expect(page).to have_title('Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel')
64
64
  end
65
65
 
66
66
  it "doesn't use meta_title as heading on page" do
67
- jersey.update_attributes metas
67
+ jersey.update metas
68
68
  click_link jersey.name
69
69
  within("h1") do
70
70
  expect(page).to have_content(jersey.name)
@@ -73,7 +73,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
73
73
  end
74
74
 
75
75
  it 'uses product name in title when meta_title set to empty string' do
76
- jersey.update_attributes meta_title: ''
76
+ jersey.update meta_title: ''
77
77
  click_link jersey.name
78
78
  expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
79
79
  end
@@ -30,14 +30,14 @@ describe "viewing products", type: :feature, inaccessible: true do
30
30
 
31
31
  describe 'meta tags and title' do
32
32
  it 'displays metas' do
33
- t_shirts.update_attributes metas
33
+ t_shirts.update metas
34
34
  visit '/t/category/super-clothing/t-shirts'
35
35
  expect(page).to have_meta(:description, 'Brand new Ruby on Rails TShirts')
36
36
  expect(page).to have_meta(:keywords, 'ror, tshirt, ruby')
37
37
  end
38
38
 
39
39
  it 'display title if set' do
40
- t_shirts.update_attributes metas
40
+ t_shirts.update metas
41
41
  visit '/t/category/super-clothing/t-shirts'
42
42
  expect(page).to have_title("Ruby On Rails TShirt")
43
43
  end
@@ -49,7 +49,7 @@ describe "viewing products", type: :feature, inaccessible: true do
49
49
 
50
50
  # Regression test for https://github.com/spree/spree/issues/2814
51
51
  it "doesn't use meta_title as heading on page" do
52
- t_shirts.update_attributes metas
52
+ t_shirts.update metas
53
53
  visit '/t/category/super-clothing/t-shirts'
54
54
  within("h1.taxon-title") do
55
55
  expect(page).to have_content(t_shirts.name)
@@ -57,7 +57,7 @@ describe "viewing products", type: :feature, inaccessible: true do
57
57
  end
58
58
 
59
59
  it 'uses taxon name in title when meta_title set to empty string' do
60
- t_shirts.update_attributes meta_title: ''
60
+ t_shirts.update meta_title: ''
61
61
  visit '/t/category/super-clothing/t-shirts'
62
62
  expect(page).to have_title('Category - T-Shirts - ' + store_name)
63
63
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.6
4
+ version: 2.10.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-16 00:00:00.000000000 Z
11
+ date: 2019-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.9.6
19
+ version: 2.10.0.beta1
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.9.6
26
+ version: 2.10.0.beta1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: solidus_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.9.6
33
+ version: 2.10.0.beta1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.9.6
40
+ version: 2.10.0.beta1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: canonical-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: responders
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: sassc-rails
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -204,7 +218,6 @@ files:
204
218
  - app/controllers/spree/taxons_controller.rb
205
219
  - app/helpers/spree/orders_helper.rb
206
220
  - app/helpers/spree/taxon_filters_helper.rb
207
- - app/models/spree/frontend_configuration.rb
208
221
  - app/views/spree/address/_form.html.erb
209
222
  - app/views/spree/address/_form_hidden.html.erb
210
223
  - app/views/spree/checkout/_address.html.erb
@@ -264,8 +277,10 @@ files:
264
277
  - lib/generators/solidus/views/override_generator.rb
265
278
  - lib/solidus_frontend.rb
266
279
  - lib/spree/frontend.rb
280
+ - lib/spree/frontend/config.rb
267
281
  - lib/spree/frontend/engine.rb
268
282
  - lib/spree/frontend/middleware/seo_assist.rb
283
+ - lib/spree/frontend_configuration.rb
269
284
  - lib/spree_frontend.rb
270
285
  - lib/tasks/rake_util.rb
271
286
  - lib/tasks/taxon.rake
@@ -332,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
332
347
  version: 1.8.23
333
348
  requirements:
334
349
  - none
335
- rubygems_version: 3.0.3
350
+ rubygems_version: 3.0.6
336
351
  signing_key:
337
352
  specification_version: 4
338
353
  summary: Cart and storefront for the Solidus e-commerce project.