solidus_frontend 2.10.5 → 2.11.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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/frontend/checkout/address.js +1 -1
  3. data/app/assets/javascripts/spree/frontend/checkout/coupon-code.js +1 -1
  4. data/app/controllers/spree/checkout_controller.rb +9 -5
  5. data/app/controllers/spree/orders_controller.rb +9 -9
  6. data/app/controllers/spree/products_controller.rb +1 -1
  7. data/app/views/spree/address/_form.html.erb +15 -8
  8. data/app/views/spree/address/_form_hidden.html.erb +6 -2
  9. data/app/views/spree/checkout/payment/_gateway.html.erb +1 -1
  10. data/app/views/spree/orders/_form.html.erb +1 -1
  11. data/app/views/spree/shared/_address.html.erb +1 -1
  12. data/app/views/spree/shared/_image.html.erb +3 -2
  13. data/solidus_frontend.gemspec +5 -5
  14. metadata +10 -53
  15. data/script/rails +0 -10
  16. data/spec/controllers/controller_helpers_spec.rb +0 -29
  17. data/spec/controllers/locale_controller_spec.rb +0 -57
  18. data/spec/controllers/spree/checkout_controller_spec.rb +0 -610
  19. data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -37
  20. data/spec/controllers/spree/content_controller_spec.rb +0 -9
  21. data/spec/controllers/spree/current_order_tracking_spec.rb +0 -47
  22. data/spec/controllers/spree/home_controller_spec.rb +0 -29
  23. data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -90
  24. data/spec/controllers/spree/orders_controller_spec.rb +0 -254
  25. data/spec/controllers/spree/orders_controller_transitions_spec.rb +0 -33
  26. data/spec/controllers/spree/products_controller_spec.rb +0 -38
  27. data/spec/controllers/spree/taxons_controller_spec.rb +0 -14
  28. data/spec/features/address_spec.rb +0 -78
  29. data/spec/features/automatic_promotion_adjustments_spec.rb +0 -49
  30. data/spec/features/caching/products_spec.rb +0 -48
  31. data/spec/features/caching/taxons_spec.rb +0 -21
  32. data/spec/features/cart_spec.rb +0 -85
  33. data/spec/features/checkout_confirm_insufficient_stock_spec.rb +0 -71
  34. data/spec/features/checkout_spec.rb +0 -758
  35. data/spec/features/checkout_unshippable_spec.rb +0 -37
  36. data/spec/features/coupon_code_spec.rb +0 -266
  37. data/spec/features/currency_spec.rb +0 -20
  38. data/spec/features/first_order_promotion_spec.rb +0 -59
  39. data/spec/features/free_shipping_promotions_spec.rb +0 -60
  40. data/spec/features/locale_spec.rb +0 -26
  41. data/spec/features/order_spec.rb +0 -73
  42. data/spec/features/products_spec.rb +0 -291
  43. data/spec/features/promotion_code_invalidation_spec.rb +0 -54
  44. data/spec/features/quantity_promotions_spec.rb +0 -130
  45. data/spec/features/taxons_spec.rb +0 -158
  46. data/spec/features/template_rendering_spec.rb +0 -20
  47. data/spec/fixtures/thinking-cat.jpg +0 -0
  48. data/spec/generators/solidus/views/override_generator_spec.rb +0 -50
  49. data/spec/helpers/base_helper_spec.rb +0 -13
  50. data/spec/helpers/order_helper_spec.rb +0 -14
  51. data/spec/helpers/taxon_filters_helper_spec.rb +0 -12
  52. data/spec/spec_helper.rb +0 -106
  53. data/spec/support/shared_contexts/checkout_setup.rb +0 -12
  54. data/spec/support/shared_contexts/custom_products.rb +0 -28
  55. data/spec/support/shared_contexts/locales.rb +0 -16
  56. data/spec/views/spree/checkout/_summary_spec.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce7f908d3872005dd581845445d085019bd2a9386418024ac13c0a80b07182cb
4
- data.tar.gz: 1e99aabbf189a2731f6bdf656312e30c66fa683d2246d679a2ae825003857fce
3
+ metadata.gz: 8276f0fe5ca9fe4d4a2d8d327f7d9b5a747564c69a101bf95168f3462e8ce6b3
4
+ data.tar.gz: c51e8b73de741bc504e151d55a79e3715a37f4bc88a574d4a9c96b6ceae889c4
5
5
  SHA512:
6
- metadata.gz: a731ec7c6b6919a6a45b4c4774eaad542eb9b81a175f3bec58835cedb357da13c3db0c98b142ab123ef50d6825deb84a44ee407986599ee03dbee0aad1e0a2df
7
- data.tar.gz: 20a84b9001b6f4de3a8ed97e817d2ce942eb7111d3619505de4d721ca3eb46fe24cb7c034e0d3daf24216b2f078fd76754710dcb2523b38d376bdbbc01f98b0f
6
+ metadata.gz: dcc274c38109e0f2bae29bc3820f13d679705b5132657950983e2347bc3d4d5e8c23c7e74a92e0961f21d6a38323b0b367e561a92ee2a06642eebaf1f33ebfaa
7
+ data.tar.gz: 01366c21ebae0cebdb9e7fbfdd2f1778ea54159ff5f0c627e093c0fcd70cbd49d18d1e4a781c41212cee42e560f0684e74b74efc949a3860e12d21a8e96cf247
@@ -14,7 +14,7 @@ Spree.ready(function($) {
14
14
  if (countryId != null) {
15
15
  if (statesByCountry[countryId] == null) {
16
16
  $.get(
17
- Spree.routes.states_search,
17
+ Spree.pathFor('api/states'),
18
18
  {
19
19
  country_id: countryId
20
20
  },
@@ -15,7 +15,7 @@ Spree.onCouponCodeApply = function(e) {
15
15
  };
16
16
  var req = Spree.ajax({
17
17
  method: 'POST',
18
- url: Spree.routes.apply_coupon_code(Spree.current_order_id),
18
+ url: Spree.pathFor('api/orders/' + Spree.current_order_id + '/coupon_codes'),
19
19
  data: JSON.stringify(data),
20
20
  contentType: "application/json"
21
21
  });
@@ -8,8 +8,8 @@ module Spree
8
8
  class CheckoutController < Spree::StoreController
9
9
  before_action :load_order
10
10
  around_action :lock_order
11
- before_action :set_state_if_present
12
11
 
12
+ before_action :ensure_order_is_not_skipping_states
13
13
  before_action :ensure_order_not_completed
14
14
  before_action :ensure_checkout_allowed
15
15
  before_action :ensure_sufficient_stock_lines
@@ -153,13 +153,18 @@ module Spree
153
153
  # when trying to change it via params[:state]. It's not allowed to
154
154
  # jump forward and skip states (unless #skip_state_validation? is
155
155
  # truthy).
156
- def set_state_if_present
156
+ def ensure_order_is_not_skipping_states
157
157
  if params[:state]
158
158
  redirect_to checkout_state_path(@order.state) if @order.can_go_to_state?(params[:state]) && !skip_state_validation?
159
159
  @order.state = params[:state]
160
160
  end
161
161
  end
162
162
 
163
+ def set_state_if_present
164
+ ensure_order_is_not_skipping_states
165
+ end
166
+ deprecate set_state_if_present: :prevent_order_from_skipping_states, deprecator: Spree::Deprecation
167
+
163
168
  def ensure_checkout_allowed
164
169
  unless @order.checkout_allowed?
165
170
  redirect_to spree.cart_path
@@ -210,9 +215,8 @@ module Spree
210
215
  @order.assign_default_user_addresses
211
216
  # If the user has a default address, the previous method call takes care
212
217
  # of setting that; but if he doesn't, we need to build an empty one here
213
- default = { country_id: Spree::Country.default.id }
214
- @order.build_bill_address(default) unless @order.bill_address
215
- @order.build_ship_address(default) if @order.checkout_steps.include?('delivery') && !@order.ship_address
218
+ @order.bill_address ||= Spree::Address.build_default
219
+ @order.ship_address ||= Spree::Address.build_default if @order.checkout_steps.include?('delivery')
216
220
  end
217
221
 
218
222
  def before_delivery
@@ -15,7 +15,7 @@ module Spree
15
15
 
16
16
  def show
17
17
  @order = Spree::Order.find_by!(number: params[:id])
18
- authorize! :read, @order, cookies.signed[:guest_token]
18
+ authorize! :show, @order, cookies.signed[:guest_token]
19
19
  end
20
20
 
21
21
  def update
@@ -39,8 +39,8 @@ module Spree
39
39
 
40
40
  # Shows the current incomplete order from the session
41
41
  def edit
42
- @order = current_order || Spree::Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])
43
- authorize! :read, @order, cookies.signed[:guest_token]
42
+ @order = current_order(build_order_if_necessary: true)
43
+ authorize! :edit, @order, cookies.signed[:guest_token]
44
44
  associate_user
45
45
  if params[:id] && @order.number != params[:id]
46
46
  flash[:error] = t('spree.cannot_edit_orders')
@@ -59,12 +59,12 @@ module Spree
59
59
  # 2,147,483,647 is crazy. See issue https://github.com/spree/spree/issues/2695.
60
60
  if !quantity.between?(1, 2_147_483_647)
61
61
  @order.errors.add(:base, t('spree.please_enter_reasonable_quantity'))
62
- end
63
-
64
- begin
65
- @line_item = @order.contents.add(variant, quantity)
66
- rescue ActiveRecord::RecordInvalid => error
67
- @order.errors.add(:base, error.record.errors.full_messages.join(", "))
62
+ else
63
+ begin
64
+ @line_item = @order.contents.add(variant, quantity)
65
+ rescue ActiveRecord::RecordInvalid => error
66
+ @order.errors.add(:base, error.record.errors.full_messages.join(", "))
67
+ end
68
68
  end
69
69
 
70
70
  respond_with(@order) do |format|
@@ -38,7 +38,7 @@ module Spree
38
38
 
39
39
  def load_product
40
40
  if try_spree_current_user.try(:has_spree_role?, "admin")
41
- @products = Spree::Product.with_deleted
41
+ @products = Spree::Product.with_discarded
42
42
  else
43
43
  @products = Spree::Product.available
44
44
  end
@@ -1,14 +1,21 @@
1
1
  <% address_id = address_type.chars.first %>
2
2
  <div class="inner" data-hook=<%="#{address_type}_inner" %>>
3
- <div class="field field-required" id=<%="#{address_id}firstname" %>>
4
- <%= form.label :firstname, t('spree.first_name') %>
5
- <%= form.text_field :firstname, class: 'required', autocomplete: address_type + ' given-name', required: true, autofocus: true %>
6
- </div>
3
+ <% if Spree::Config.use_combined_first_and_last_name_in_address %>
4
+ <div class="field field-required" id="<%= "#{address_id}name" %>">
5
+ <%= form.label :name, t('spree.name') %>
6
+ <%= form.text_field :name, class: 'required', autocomplete: address_type + ' name', required: true, autofocus: true %>
7
+ </div>
8
+ <% else %>
9
+ <div class="field field-required" id="<%= "#{address_id}firstname" %>">
10
+ <%= form.label :firstname, t('spree.first_name') %>
11
+ <%= form.text_field :firstname, class: 'required', autocomplete: address_type + ' given-name', required: true, autofocus: true %>
12
+ </div>
7
13
 
8
- <div class="field" id=<%="#{address_id}lastname" %>>
9
- <%= form.label :lastname, t('spree.last_name') %>
10
- <%= form.text_field :lastname, autocomplete: address_type + ' family-name' %>
11
- </div>
14
+ <div class="field" id="<%= "#{address_id}lastname" %>">
15
+ <%= form.label :lastname, t('spree.last_name') %>
16
+ <%= form.text_field :lastname, autocomplete: address_type + ' family-name' %>
17
+ </div>
18
+ <% end %>
12
19
 
13
20
  <% if Spree::Config[:company] %>
14
21
  <div class="field" id=<%="#{address_id}company" %>>
@@ -1,5 +1,9 @@
1
- <%= form.hidden_field :firstname %>
2
- <%= form.hidden_field :lastname %>
1
+ <% if Spree::Config.use_combined_first_and_last_name_in_address %>
2
+ <%= form.hidden_field :name %>
3
+ <% else %>
4
+ <%= form.hidden_field :firstname %>
5
+ <%= form.hidden_field :lastname %>
6
+ <% end %>
3
7
  <%= form.hidden_field :company %>
4
8
  <%= form.hidden_field :address1 %>
5
9
  <%= form.hidden_field :address2 %>
@@ -3,7 +3,7 @@
3
3
 
4
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", class: 'cardName' } %>
6
+ <%= text_field_tag "#{param_prefix}[name]", @order.billing_name, { id: "name_on_card_#{payment_method.id}", autocomplete: "cc-name", class: 'cardName' } %>
7
7
  </div>
8
8
 
9
9
  <div class="field field-required card_number" data-hook="card_number">
@@ -13,7 +13,7 @@
13
13
  <tbody id="line_items" data-hook>
14
14
  <%= render partial: 'spree/orders/line_item', collection: order.line_items, locals: { order_form: order_form } %>
15
15
  </tbody>
16
- <% if order.adjustments.nonzero.exists? || order.line_item_adjustments.nonzero.exists? || order.shipment_adjustments.nonzero.exists? || order.shipments.any? %>
16
+ <% if order.all_adjustments.nonzero.any? || order.shipments.any? %>
17
17
  <tr class="cart-subtotal">
18
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>
@@ -1,5 +1,5 @@
1
1
  <div class="address vcard">
2
- <div class="fn"><%= address.full_name %></div>
2
+ <div class="fn"><%= address.name %></div>
3
3
  <% unless address.company.blank? %>
4
4
  <div class="org">
5
5
  <%= address.company %>
@@ -1,11 +1,12 @@
1
1
  <% size ||= :mini %>
2
2
  <% itemprop ||= nil %>
3
+ <% options ||= {} %>
3
4
 
4
5
  <% if image_url = image.try(:url, size) %>
5
6
  <% if image_alt = image.try(:alt) %>
6
- <%= image_tag image_url, alt: image_alt, itemprop: itemprop %>
7
+ <%= image_tag image_url, { alt: image_alt, itemprop: itemprop }.merge(options) %>
7
8
  <% else %>
8
- <%= image_tag image_url, itemprop: itemprop %>
9
+ <%= image_tag image_url, { itemprop: itemprop }.merge(options) %>
9
10
  <% end %>
10
11
  <% else %>
11
12
  <span class="image-placeholder <%= size %>"></span>
@@ -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_api', s.version
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.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_api
@@ -16,28 +16,28 @@ 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
  - !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.10.5
33
+ version: 2.11.0
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.10.5
40
+ version: 2.11.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: canonical-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -284,50 +284,8 @@ files:
284
284
  - lib/spree_frontend.rb
285
285
  - lib/tasks/rake_util.rb
286
286
  - lib/tasks/taxon.rake
287
- - script/rails
288
287
  - solidus_frontend.gemspec
289
- - spec/controllers/controller_helpers_spec.rb
290
- - spec/controllers/locale_controller_spec.rb
291
- - spec/controllers/spree/checkout_controller_spec.rb
292
- - spec/controllers/spree/checkout_controller_with_views_spec.rb
293
- - spec/controllers/spree/content_controller_spec.rb
294
- - spec/controllers/spree/current_order_tracking_spec.rb
295
- - spec/controllers/spree/home_controller_spec.rb
296
- - spec/controllers/spree/orders_controller_ability_spec.rb
297
- - spec/controllers/spree/orders_controller_spec.rb
298
- - spec/controllers/spree/orders_controller_transitions_spec.rb
299
- - spec/controllers/spree/products_controller_spec.rb
300
- - spec/controllers/spree/taxons_controller_spec.rb
301
- - spec/features/address_spec.rb
302
- - spec/features/automatic_promotion_adjustments_spec.rb
303
- - spec/features/caching/products_spec.rb
304
- - spec/features/caching/taxons_spec.rb
305
- - spec/features/cart_spec.rb
306
- - spec/features/checkout_confirm_insufficient_stock_spec.rb
307
- - spec/features/checkout_spec.rb
308
- - spec/features/checkout_unshippable_spec.rb
309
- - spec/features/coupon_code_spec.rb
310
- - spec/features/currency_spec.rb
311
- - spec/features/first_order_promotion_spec.rb
312
- - spec/features/free_shipping_promotions_spec.rb
313
- - spec/features/locale_spec.rb
314
- - spec/features/order_spec.rb
315
- - spec/features/products_spec.rb
316
- - spec/features/promotion_code_invalidation_spec.rb
317
- - spec/features/quantity_promotions_spec.rb
318
- - spec/features/taxons_spec.rb
319
- - spec/features/template_rendering_spec.rb
320
- - spec/fixtures/thinking-cat.jpg
321
- - spec/generators/solidus/views/override_generator_spec.rb
322
- - spec/helpers/base_helper_spec.rb
323
- - spec/helpers/order_helper_spec.rb
324
- - spec/helpers/taxon_filters_helper_spec.rb
325
- - spec/spec_helper.rb
326
- - spec/support/shared_contexts/checkout_setup.rb
327
- - spec/support/shared_contexts/custom_products.rb
328
- - spec/support/shared_contexts/locales.rb
329
- - spec/views/spree/checkout/_summary_spec.rb
330
- homepage: http://solidus.io/
288
+ homepage: http://solidus.io
331
289
  licenses:
332
290
  - BSD-3-Clause
333
291
  metadata: {}
@@ -339,15 +297,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
339
297
  requirements:
340
298
  - - ">="
341
299
  - !ruby/object:Gem::Version
342
- version: 2.4.0
300
+ version: 2.5.0
343
301
  required_rubygems_version: !ruby/object:Gem::Requirement
344
302
  requirements:
345
303
  - - ">="
346
304
  - !ruby/object:Gem::Version
347
305
  version: 1.8.23
348
- requirements:
349
- - none
350
- rubygems_version: 3.1.4
306
+ requirements: []
307
+ rubygems_version: 3.0.3
351
308
  signing_key:
352
309
  specification_version: 4
353
310
  summary: Cart and storefront for the Solidus e-commerce project.
data/script/rails DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
5
-
6
- ENGINE_ROOT = File.expand_path('..', __dir__)
7
- ENGINE_PATH = File.expand_path('../lib/spree/frontend/engine', __dir__)
8
-
9
- require 'rails/all'
10
- require 'rails/engine/commands'
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- # In this file, we want to test that the controller helpers function correctly
6
- # So we need to use one of the controllers inside Spree.
7
- # ProductsController is good.
8
- describe Spree::ProductsController, type: :controller do
9
- before do
10
- I18n.enforce_available_locales = false
11
- stub_spree_preferences(Spree::Frontend::Config, locale: :de)
12
- I18n.backend.store_translations(:de, spree: {
13
- i18n: { this_file_language: "Deutsch (DE)" }
14
- })
15
- end
16
-
17
- after do
18
- I18n.reload!
19
- I18n.locale = :en
20
- I18n.enforce_available_locales = true
21
- end
22
-
23
- # Regression test for https://github.com/spree/spree/issues/1184
24
- it "sets the default locale based off Spree::Frontend::Config[:locale]" do
25
- expect(I18n.locale).to eq(:en)
26
- get :index
27
- expect(I18n.locale).to eq(:de)
28
- end
29
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Spree::LocaleController, type: :controller do
6
- include_context "fr locale"
7
-
8
- context 'switch_to_locale specified' do
9
- context "available locale" do
10
- it 'sets locale and redirects' do
11
- get :set, params: { switch_to_locale: 'fr' }
12
- expect(I18n.locale).to eq :fr
13
- expect(response).to redirect_to('/')
14
- expect(session[:locale]).to eq('fr')
15
- expect(flash[:notice]).to eq(I18n.t("spree.locale_changed"))
16
- end
17
- end
18
-
19
- context "unavailable locale" do
20
- it 'does not change locale and redirects' do
21
- get :set, params: { switch_to_locale: 'klingon' }
22
- expect(I18n.locale).to eq :en
23
- expect(response).to redirect_to('/')
24
- expect(flash[:error]).to eq(I18n.t("spree.locale_not_changed"))
25
- end
26
- end
27
- end
28
-
29
- context 'locale specified' do
30
- context "available locale" do
31
- it 'sets locale and redirects' do
32
- get :set, params: { locale: 'fr' }
33
- expect(I18n.locale).to eq :fr
34
- expect(response).to redirect_to('/')
35
- expect(flash[:notice]).to eq(I18n.t("spree.locale_changed"))
36
- end
37
- end
38
-
39
- context "unavailable locale" do
40
- it 'does not change locale and redirects' do
41
- get :set, params: { locale: 'klingon' }
42
- expect(I18n.locale).to eq :en
43
- expect(response).to redirect_to('/')
44
- expect(flash[:error]).to eq(I18n.t("spree.locale_not_changed"))
45
- end
46
- end
47
- end
48
-
49
- context 'both locale and switch_to_locale specified' do
50
- it 'uses switch_to_locale value' do
51
- get :set, params: { locale: 'en', switch_to_locale: 'fr' }
52
- expect(I18n.locale).to eq :fr
53
- expect(response).to redirect_to('/')
54
- expect(flash[:notice]).to eq(I18n.t("spree.locale_changed"))
55
- end
56
- end
57
- end