solidus_frontend 2.6.5 → 2.9.0

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.

Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -5
  3. data/app/assets/images/favicon.ico +0 -0
  4. data/app/assets/javascripts/spree/frontend/checkout/coupon-code.js +2 -1
  5. data/app/assets/stylesheets/spree/frontend/screen.css.scss +39 -1
  6. data/app/controllers/spree/checkout_controller.rb +61 -3
  7. data/app/controllers/spree/coupon_codes_controller.rb +35 -0
  8. data/app/controllers/spree/locale_controller.rb +1 -1
  9. data/app/controllers/spree/orders_controller.rb +27 -12
  10. data/app/controllers/spree/store_controller.rb +0 -18
  11. data/app/controllers/spree/taxons_controller.rb +6 -3
  12. data/app/views/spree/checkout/_coupon_code.html.erb +12 -0
  13. data/app/views/spree/checkout/_delivery.html.erb +6 -2
  14. data/app/views/spree/checkout/_payment.html.erb +0 -10
  15. data/app/views/spree/checkout/_summary.html.erb +4 -0
  16. data/app/views/spree/checkout/payment/_gateway.html.erb +6 -5
  17. data/app/views/spree/coupon_codes/new.html.erb +6 -0
  18. data/app/views/spree/orders/_form.html.erb +1 -1
  19. data/app/views/spree/orders/_line_item.html.erb +3 -5
  20. data/app/views/spree/orders/edit.html.erb +5 -6
  21. data/app/views/spree/products/_image.html.erb +4 -1
  22. data/app/views/spree/products/_thumbnails.html.erb +10 -8
  23. data/app/views/spree/shared/_image.html.erb +4 -4
  24. data/app/views/spree/shared/_locale_selector.html.erb +1 -1
  25. data/app/views/spree/shared/_order_details.html.erb +3 -5
  26. data/app/views/spree/shared/_products.html.erb +1 -1
  27. data/config/routes.rb +1 -0
  28. data/lib/spree/frontend.rb +1 -1
  29. data/solidus_frontend.gemspec +1 -1
  30. data/spec/controllers/spree/checkout_controller_spec.rb +109 -9
  31. data/spec/controllers/spree/checkout_controller_with_views_spec.rb +1 -1
  32. data/spec/controllers/spree/home_controller_spec.rb +1 -1
  33. data/spec/controllers/spree/orders_controller_ability_spec.rb +11 -30
  34. data/spec/controllers/spree/orders_controller_spec.rb +54 -3
  35. data/spec/controllers/spree/products_controller_spec.rb +3 -3
  36. data/spec/controllers/spree/taxons_controller_spec.rb +1 -1
  37. data/spec/features/address_spec.rb +1 -1
  38. data/spec/features/automatic_promotion_adjustments_spec.rb +2 -2
  39. data/spec/features/caching/taxons_spec.rb +1 -1
  40. data/spec/features/checkout_confirm_insufficient_stock_spec.rb +71 -0
  41. data/spec/features/checkout_spec.rb +34 -25
  42. data/spec/features/coupon_code_spec.rb +96 -56
  43. data/spec/features/currency_spec.rb +1 -1
  44. data/spec/features/first_order_promotion_spec.rb +59 -0
  45. data/spec/features/free_shipping_promotions_spec.rb +2 -2
  46. data/spec/features/products_spec.rb +8 -8
  47. data/spec/features/promotion_code_invalidation_spec.rb +2 -2
  48. data/spec/features/quantity_promotions_spec.rb +9 -9
  49. data/spec/spec_helper.rb +1 -1
  50. metadata +14 -9
  51. data/spec/support/features/fill_in_with_force.rb +0 -12
@@ -56,16 +56,6 @@
56
56
  <% end %>
57
57
  </ul>
58
58
  <br style="clear:both;" />
59
- <p class='field' data-hook='coupon_code'>
60
- <%= form.label :coupon_code %>
61
- <%= form.text_field :coupon_code %>
62
- <button type="button" class="button" id="coupon-code-apply-button">
63
- <%= t('spree.apply_code') %>
64
- </button>
65
-
66
- </p>
67
- <div id='coupon_status'></div>
68
-
69
59
  </div>
70
60
  </fieldset>
71
61
 
@@ -70,3 +70,7 @@
70
70
  </tr>
71
71
  </tbody>
72
72
  </table>
73
+
74
+ <% if order.state == 'payment' %>
75
+ <%= render 'coupon_code', order: order %>
76
+ <% end %>
@@ -1,14 +1,15 @@
1
1
  <%= image_tag 'credit_cards/credit_card.gif', id: 'credit-card-image' %>
2
2
  <% param_prefix = "payment_source[#{payment_method.id}]" %>
3
3
 
4
- <div class="field field-required">
4
+ <div class="field field-required card_name" data-hook="card_name">
5
5
  <%= label_tag "name_on_card_#{payment_method.id}", t('spree.name_on_card') %>
6
- <%= text_field_tag "#{param_prefix}[name]", "#{@order.billing_firstname} #{@order.billing_lastname}", { id: "name_on_card_#{payment_method.id}", autocomplete: "cc-name" } %>
6
+ <%= text_field_tag "#{param_prefix}[name]", "#{@order.billing_firstname} #{@order.billing_lastname}", { id: "name_on_card_#{payment_method.id}", autocomplete: "cc-name", class: 'cardName' } %>
7
7
  </div>
8
8
 
9
- <div class="field field-required" data-hook="card_number">
9
+ <div class="field field-required card_number" data-hook="card_number">
10
10
  <%= label_tag "card_number", t('spree.card_number') %>
11
11
  <%= text_field_tag "#{param_prefix}[number]", '', {id: 'card_number', class: 'required cardNumber', size: 19, maxlength: 19, autocomplete: "cc-number", type: "tel" } %>
12
+
12
13
  <span id="card_type" style="display:none;">
13
14
  ( <span id="looks_like" ><%= t('spree.card_type_is') %> <span id="type"></span></span>
14
15
  <span id="unrecognized"><%= t('spree.unrecognized_card_type') %></span>
@@ -16,12 +17,12 @@
16
17
  </span>
17
18
  </div>
18
19
 
19
- <div class="field field-required" data-hook="card_expiration">
20
+ <div class="field field-required card_expiration" data-hook="card_expiration">
20
21
  <%= label_tag "card_expiry", t('spree.expiration') %>
21
22
  <%= text_field_tag "#{param_prefix}[expiry]", '', id: 'card_expiry', class: "required cardExpiry", placeholder: "MM / YY", type: "tel" %>
22
23
  </div>
23
24
 
24
- <div class="field field-required" data-hook="card_code">
25
+ <div class="field field-required card_code" data-hook="card_code">
25
26
  <%= label_tag "card_code", t('spree.card_code') %>
26
27
  <%= text_field_tag "#{param_prefix}[verification_value]", '', {id: 'card_code', class: 'required cardCode', size: 5, type: "tel", autocomplete: "off" } %>
27
28
  <%= link_to "(#{t('spree.what_is_this')})", spree.cvv_path, target: '_blank', "data-hook" => "cvv_link", id: "cvv_link" %>
@@ -0,0 +1,6 @@
1
+ <div id="coupon_code" data-hook="coupon_code">
2
+ <%= form_tag order_coupon_codes_path(@order), method: :post do %>
3
+ <%= text_field_tag :coupon_code, nil, placeholder: t("spree.coupon_code"), size: 10 %>
4
+ <%= submit_tag t("spree.apply_code") %>
5
+ <% end %>
6
+ </div>
@@ -15,7 +15,7 @@
15
15
  </tbody>
16
16
  <% if order.adjustments.nonzero.exists? || order.line_item_adjustments.nonzero.exists? || order.shipment_adjustments.nonzero.exists? || order.shipments.any? %>
17
17
  <tr class="cart-subtotal">
18
- <td colspan="4" align='right'><h5><%= t('spree.cart_subtotal', count: order.line_items.sum(:quantity)) %></h5></th>
18
+ <td colspan="4" align='right'><h5><%= t('spree.cart_subtotal', count: order.line_items.sum(:quantity)) %></h5></td>
19
19
  <td colspan><h5><%= order.display_item_total %></h5></td>
20
20
  <td></td>
21
21
  </tr>
@@ -2,11 +2,9 @@
2
2
  <%= order_form.fields_for :line_items, line_item do |item_form| -%>
3
3
  <tr class="<%= cycle('', 'alt') %> line-item">
4
4
  <td class="cart-item-image" data-hook="cart_item_image">
5
- <% if variant.images.empty? %>
6
- <%= link_to(render('spree/shared/image', image: variant.product.display_image, size: :small), variant.product) %>
7
- <% else %>
8
- <%= link_to(render('spree/shared/image', image: variant.images.first, size: :small), variant.product) %>
9
- <% end %>
5
+ <%= link_to(render('spree/shared/image',
6
+ image: (variant.gallery.images.first || variant.product.gallery.images.first),
7
+ size: :small), variant.product) %>
10
8
  </td>
11
9
  <td class="cart-item-description" data-hook="cart_item_description">
12
10
  <h4><%= link_to line_item.name, product_path(variant.product) %></h4>
@@ -16,19 +16,16 @@
16
16
  <div data-hook="inside_cart_form">
17
17
 
18
18
  <div data-hook="cart_items">
19
- <%= render 'form', order_form: order_form %>
19
+ <%= render 'spree/orders/form', order_form: order_form %>
20
20
  </div>
21
21
 
22
22
  <div class="links columns sixteen alpha omega" data-hook="cart_buttons">
23
- <%= order_form.text_field :coupon_code, size: 10, placeholder: t('spree.coupon_code') %>
24
- <%= button_tag class: 'primary', id: 'update-button' do %>
25
- <%= t('spree.update') %>
26
- <% end %>
23
+ <%= button_tag t("spree.update"), class: "primary", id: "update-button" %>
24
+
27
25
  <%= button_tag class: 'button checkout primary', id: 'checkout-link', name: 'checkout' do %>
28
26
  <%= t('spree.checkout') %>
29
27
  <% end %>
30
28
  </div>
31
-
32
29
  </div>
33
30
  <% end %>
34
31
  </div>
@@ -41,6 +38,8 @@
41
38
  <%= link_to t('spree.continue_shopping'), products_path, class: 'continue button gray' %>
42
39
  </p>
43
40
  <% end %>
41
+
42
+ <%= render template: 'spree/coupon_codes/new' %>
44
43
  </div>
45
44
 
46
45
  <% end %>
@@ -1,5 +1,8 @@
1
1
  <% if defined?(image) && image %>
2
2
  <%= render 'spree/shared/image', image: image, size: :product, itemprop: "image" %>
3
3
  <% else %>
4
- <%= render 'spree/shared/image', image: @product.display_image, size: :product, itemprop: "image" %>
4
+ <%= render 'spree/shared/image',
5
+ image: @product.gallery.images.first,
6
+ size: :product,
7
+ itemprop: "image" %>
5
8
  <% end %>
@@ -1,17 +1,19 @@
1
1
  <%# no need for thumbnails unless there is more than one image %>
2
- <% if (@product.images + @product.variant_images).uniq.size > 1 %>
2
+ <% if @product.gallery.images.size > 1 %>
3
3
  <ul id="product-thumbnails" class="thumbnails inline" data-hook>
4
- <% @product.images.each do |i| %>
5
- <li class='tmb-all tmb-<%= i.viewable.id %>'>
6
- <%= link_to(image_tag(i.attachment.url(:mini)), i.attachment.url(:product)) %>
4
+
5
+ <% @product.gallery.images.each do |image| %>
6
+ <% next if image.viewable_id != @product.master.id %>
7
+ <li class='tmb-all tmb-<%= image.viewable_id %>'>
8
+ <%= link_to(image_tag(image.url(:mini)), image.url(:product)) %>
7
9
  </li>
8
10
  <% end %>
9
11
 
10
12
  <% if @product.has_variants? %>
11
- <% @product.variant_images.each do |i| %>
12
- <% next if @product.images.include?(i) %>
13
- <li class='vtmb tmb-<%= i.viewable.id %>'>
14
- <%= link_to(image_tag(i.attachment.url(:mini)), i.attachment.url(:product)) %>
13
+ <% @product.gallery.images.each do |image| %>
14
+ <% next if image.viewable_id == @product.master.id %>
15
+ <li class='vtmb tmb-<%= image.viewable_id %>'>
16
+ <%= link_to(image_tag(image.url(:mini)), image.url(:product)) %>
15
17
  </li>
16
18
  <% end %>
17
19
  <% end %>
@@ -1,11 +1,11 @@
1
1
  <% size ||= :mini %>
2
2
  <% itemprop ||= nil %>
3
3
 
4
- <% if image && image.attachment? %>
5
- <% if itemprop %>
6
- <%= image_tag image.attachment(size), itemprop: itemprop %>
4
+ <% if image_url = image.try(:url, size) %>
5
+ <% if image_alt = image.try(:alt) %>
6
+ <%= image_tag image_url, alt: image_alt, itemprop: itemprop %>
7
7
  <% else %>
8
- <%= image_tag image.attachment(size) %>
8
+ <%= image_tag image_url, itemprop: itemprop %>
9
9
  <% end %>
10
10
  <% else %>
11
11
  <span class="image-placeholder <%= size %>"></span>
@@ -4,7 +4,7 @@
4
4
  <%= form_tag spree.select_locale_path, class: 'navbar-form' do %>
5
5
  <div class="form-group">
6
6
  <label for="switch_to_locale" class="sr-only">
7
- <%= Spree.t(:'i18n.language') %>
7
+ <%= I18n.t('spree.i18n.language') %>
8
8
  </label>
9
9
  <%=
10
10
  select_tag(
@@ -62,11 +62,9 @@
62
62
  <% order.line_items.each do |item| %>
63
63
  <tr data-hook="order_details_line_item_row">
64
64
  <td data-hook="order_item_image">
65
- <% if item.variant.images.empty? %>
66
- <%= link_to(render('spree/shared/image', image: item.variant.product.display_image, size: :small), item.variant.product) %>
67
- <% else %>
68
- <%= link_to(render('spree/shared/image', image: item.variant.images.first, size: :small), item.variant.product) %>
69
- <% end %>
65
+ <%= link_to(render('spree/shared/image',
66
+ image: (item.variant.gallery.images.first || item.variant.product.gallery.images.first),
67
+ size: :small), item.variant.product) %>
70
68
  </td>
71
69
  <td data-hook="order_item_description">
72
70
  <h4><%= item.variant.product.name %></h4>
@@ -28,7 +28,7 @@
28
28
  <li id="product_<%= product.id %>" class="columns three <%= cycle("alpha", "secondary", "", "omega secondary", name: "classes") %>" data-hook="products_list_item" itemscope itemtype="http://schema.org/Product">
29
29
  <% cache(@taxon.present? ? [I18n.locale, current_pricing_options, @taxon, product] : [I18n.locale, current_pricing_options, product]) do %>
30
30
  <div class="product-image">
31
- <%= link_to(render('spree/shared/image', image: product.display_image, size: :small, itemprop: "image"), url, itemprop: 'url') %>
31
+ <%= link_to(render('spree/shared/image', image: product.gallery.images.first, size: :small, itemprop: "image"), url, itemprop: 'url') %>
32
32
  </div>
33
33
  <%= link_to truncate(product.name, length: 50), url, class: 'info', itemprop: "name", title: product.name %>
34
34
  <span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
data/config/routes.rb CHANGED
@@ -18,6 +18,7 @@ Spree::Core::Engine.routes.draw do
18
18
 
19
19
  resources :orders, except: [:index, :new, :create, :destroy] do
20
20
  post :populate, on: :collection
21
+ resources :coupon_codes, only: :create
21
22
  end
22
23
 
23
24
  get '/cart', to: 'orders#edit', as: :cart
@@ -3,7 +3,7 @@
3
3
  require 'rails/all'
4
4
  require 'jquery-rails'
5
5
  require 'canonical-rails'
6
- require 'sass-rails'
6
+ require 'sassc-rails'
7
7
  require 'font-awesome-rails'
8
8
  require 'responders'
9
9
  require 'kaminari'
@@ -28,7 +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 'sass-rails'
31
+ s.add_dependency 'sassc-rails'
32
32
  s.add_dependency 'truncate_html', '~> 0.9', '>= 0.9.2'
33
33
 
34
34
  s.add_development_dependency 'capybara-accessible'
@@ -14,7 +14,6 @@ describe Spree::CheckoutController, type: :controller do
14
14
 
15
15
  before do
16
16
  allow(controller).to receive_messages try_spree_current_user: user
17
- allow(controller).to receive_messages spree_current_user: user
18
17
  allow(controller).to receive_messages current_order: order
19
18
  end
20
19
 
@@ -90,7 +89,7 @@ describe Spree::CheckoutController, type: :controller do
90
89
  order.line_items << FactoryBot.create(:line_item)
91
90
  end
92
91
 
93
- context "with the order in the cart state" do
92
+ context "with the order in the cart state", partial_double_verification: false do
94
93
  before do
95
94
  order.update_attributes! user: user
96
95
  order.update_column(:state, "cart")
@@ -139,7 +138,7 @@ describe Spree::CheckoutController, type: :controller do
139
138
  end
140
139
  end
141
140
 
142
- context "with the order in the address state" do
141
+ context "with the order in the address state", partial_double_verification: false do
143
142
  before do
144
143
  order.update_attributes! user: user
145
144
  order.update_columns(ship_address_id: create(:address).id, state: "address")
@@ -152,7 +151,7 @@ describe Spree::CheckoutController, type: :controller do
152
151
  end
153
152
  end
154
153
 
155
- context "with a billing and shipping address" do
154
+ context "with a billing and shipping address", partial_double_verification: false do
156
155
  subject do
157
156
  post :update, params: {
158
157
  state: "address",
@@ -184,7 +183,7 @@ describe Spree::CheckoutController, type: :controller do
184
183
  # the same thing here.
185
184
  # Perhaps we can just remove 'set_payment_parameters_amount' entirely at
186
185
  # some point?
187
- context "when there is a checkout step between payment and confirm" do
186
+ context "when there is a checkout step between payment and confirm", partial_double_verification: false do
188
187
  before do
189
188
  @old_checkout_flow = Spree::Order.checkout_flow
190
189
  Spree::Order.class_eval do
@@ -227,7 +226,7 @@ describe Spree::CheckoutController, type: :controller do
227
226
  end
228
227
  end
229
228
 
230
- context "when in the payment state" do
229
+ context "when in the payment state", partial_double_verification: false do
231
230
  let(:order) { create(:order_with_line_items) }
232
231
  let(:payment_method) { create(:credit_card_payment_method) }
233
232
 
@@ -420,6 +419,45 @@ describe Spree::CheckoutController, type: :controller do
420
419
  expect(flash[:error]).to eq(I18n.t('spree.payment_processing_failed'))
421
420
  end
422
421
  end
422
+
423
+ context "when InsufficientStock error is raised" do
424
+ before do
425
+ allow(controller).to receive_messages current_order: order
426
+ allow(controller).to receive_messages check_authorization: true
427
+ allow(controller).to receive_messages ensure_sufficient_stock_lines: true
428
+ end
429
+
430
+ context "when the order has no shipments" do
431
+ let(:order) { Spree::TestingSupport::OrderWalkthrough.up_to(:address) }
432
+
433
+ before do
434
+ allow(order).to receive_messages shipments: []
435
+ # Order#next is the tipical failure point here:
436
+ allow(order).to receive(:next).and_raise(Spree::Order::InsufficientStock)
437
+ end
438
+
439
+ it "redirects the customer to the cart page with an error message" do
440
+ put :update, params: { state: order.state, order: {} }
441
+ expect(flash[:error]).to eq(I18n.t('spree.insufficient_stock_for_order'))
442
+ expect(response).to redirect_to(spree.cart_path)
443
+ end
444
+ end
445
+
446
+ context "when the order has shipments" do
447
+ let(:order) { Spree::TestingSupport::OrderWalkthrough.up_to(:payment) }
448
+
449
+ context "when items become somehow not available anymore" do
450
+ before { Spree::StockItem.update_all backorderable: false }
451
+
452
+ it "redirects the customer to the address checkout page with an error message" do
453
+ put :update, params: { state: order.state, order: {} }
454
+ error = I18n.t('spree.inventory_error_flash_for_insufficient_shipment_quantity', unavailable_items: order.products.first.name)
455
+ expect(flash[:error]).to eq(error)
456
+ expect(response).to redirect_to(spree.checkout_state_path(state: :address))
457
+ end
458
+ end
459
+ end
460
+ end
423
461
  end
424
462
 
425
463
  context "When last inventory item has been purchased" do
@@ -431,9 +469,7 @@ describe Spree::CheckoutController, type: :controller do
431
469
  before do
432
470
  allow(order).to receive_messages(line_items: [line_item], state: "payment")
433
471
 
434
- configure_spree_preferences do |config|
435
- config.track_inventory_levels = true
436
- end
472
+ stub_spree_preferences(track_inventory_levels: true)
437
473
  end
438
474
 
439
475
  context "and back orders are not allowed" do
@@ -478,4 +514,68 @@ describe Spree::CheckoutController, type: :controller do
478
514
  post :update, params: { state: "payment" }
479
515
  }.to change { order.line_items.to_a.size }.from(1).to(0)
480
516
  end
517
+
518
+ context 'trying to apply a coupon code' do
519
+ let(:order) { create(:order_with_line_items, state: 'payment', guest_token: 'a token') }
520
+ let(:coupon_code) { "coupon_code" }
521
+
522
+ before { cookies.signed[:guest_token] = order.guest_token }
523
+
524
+ context "when coupon code is empty" do
525
+ let(:coupon_code) { "" }
526
+
527
+ it 'does not try to apply coupon code' do
528
+ expect(Spree::PromotionHandler::Coupon).not_to receive :new
529
+
530
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
531
+
532
+ expect(response).to redirect_to(spree.checkout_state_path('confirm'))
533
+ end
534
+ end
535
+
536
+ context "when coupon code is applied" do
537
+ let(:promotion_handler) { instance_double('Spree::PromotionHandler::Coupon', error: nil, success: 'Coupon Applied!') }
538
+
539
+ it "continues checkout flow normally" do
540
+ expect(Spree::Deprecation).to receive(:warn)
541
+
542
+ expect(Spree::PromotionHandler::Coupon)
543
+ .to receive_message_chain(:new, :apply)
544
+ .and_return(promotion_handler)
545
+
546
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
547
+
548
+ expect(response).to render_template :edit
549
+ expect(flash.now[:success]).to eq('Coupon Applied!')
550
+ end
551
+
552
+ context "when coupon code is not applied" do
553
+ let(:promotion_handler) { instance_double('Spree::PromotionHandler::Coupon', error: 'Some error', success: false) }
554
+
555
+ it "setups the current step correctly before rendering" do
556
+ expect(Spree::Deprecation).to receive(:warn)
557
+
558
+ expect(Spree::PromotionHandler::Coupon)
559
+ .to receive_message_chain(:new, :apply)
560
+ .and_return(promotion_handler)
561
+ expect(controller).to receive(:setup_for_current_state)
562
+
563
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
564
+ end
565
+
566
+ it "render cart with coupon error" do
567
+ expect(Spree::Deprecation).to receive(:warn)
568
+
569
+ expect(Spree::PromotionHandler::Coupon)
570
+ .to receive_message_chain(:new, :apply)
571
+ .and_return(promotion_handler)
572
+
573
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
574
+
575
+ expect(response).to render_template :edit
576
+ expect(flash.now[:error]).to eq('Some error')
577
+ end
578
+ end
579
+ end
580
+ end
481
581
  end
@@ -16,7 +16,7 @@ describe Spree::CheckoutController, type: :controller do
16
16
  # Regression test for https://github.com/spree/spree/issues/3246
17
17
  context "when using GBP" do
18
18
  before do
19
- Spree::Config[:currency] = "GBP"
19
+ stub_spree_preferences(currency: "GBP")
20
20
  end
21
21
 
22
22
  context "when order is in delivery" do
@@ -18,7 +18,7 @@ describe Spree::HomeController, type: :controller do
18
18
  end
19
19
 
20
20
  context "different layout specified in config" do
21
- before { Spree::Config.layout = 'layouts/application' }
21
+ before { stub_spree_preferences(layout: 'layouts/application') }
22
22
 
23
23
  it "renders specified layout" do
24
24
  get :index