solidus_frontend 2.5.2 → 2.6.0.rc1

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -1
  3. data/app/assets/javascripts/spree/frontend/checkout/address.js +4 -5
  4. data/app/assets/javascripts/spree/frontend/locale_selector.js +5 -0
  5. data/app/assets/javascripts/spree/frontend.js +1 -0
  6. data/app/assets/stylesheets/spree/frontend/screen.css.scss +33 -7
  7. data/app/controllers/spree/checkout_controller.rb +5 -4
  8. data/app/controllers/spree/content_controller.rb +2 -0
  9. data/app/controllers/spree/home_controller.rb +2 -0
  10. data/app/controllers/spree/locale_controller.rb +10 -6
  11. data/app/controllers/spree/orders_controller.rb +3 -1
  12. data/app/controllers/spree/products_controller.rb +3 -1
  13. data/app/controllers/spree/store_controller.rb +2 -0
  14. data/app/controllers/spree/taxons_controller.rb +3 -1
  15. data/app/helpers/spree/orders_helper.rb +2 -0
  16. data/app/helpers/spree/taxon_filters_helper.rb +13 -0
  17. data/app/models/spree/frontend_configuration.rb +2 -0
  18. data/app/views/spree/address/_form.html.erb +33 -33
  19. data/app/views/spree/checkout/_address.html.erb +2 -2
  20. data/app/views/spree/checkout/_delivery.html.erb +1 -1
  21. data/app/views/spree/checkout/_payment.html.erb +3 -3
  22. data/app/views/spree/checkout/edit.html.erb +2 -2
  23. data/app/views/spree/checkout/payment/_gateway.html.erb +12 -13
  24. data/app/views/spree/orders/_form.html.erb +1 -1
  25. data/app/views/spree/shared/_filters.html.erb +1 -1
  26. data/app/views/spree/shared/_locale_selector.html.erb +25 -0
  27. data/app/views/spree/shared/_nav_bar.html.erb +1 -0
  28. data/config/initializers/assets.rb +2 -0
  29. data/config/initializers/canonical_rails.rb +2 -0
  30. data/config/routes.rb +3 -0
  31. data/lib/generators/solidus/views/override_generator.rb +2 -0
  32. data/lib/solidus_frontend.rb +2 -0
  33. data/lib/spree/frontend/engine.rb +2 -0
  34. data/lib/spree/frontend/middleware/seo_assist.rb +2 -0
  35. data/lib/spree/frontend.rb +2 -0
  36. data/lib/spree_frontend.rb +2 -0
  37. data/lib/tasks/rake_util.rb +2 -0
  38. data/lib/tasks/taxon.rake +2 -0
  39. data/script/rails +4 -2
  40. data/solidus_frontend.gemspec +4 -3
  41. data/spec/controllers/controller_helpers_spec.rb +6 -0
  42. data/spec/controllers/locale_controller_spec.rb +57 -0
  43. data/spec/controllers/spree/checkout_controller_spec.rb +2 -0
  44. data/spec/controllers/spree/checkout_controller_with_views_spec.rb +3 -2
  45. data/spec/controllers/spree/content_controller_spec.rb +2 -0
  46. data/spec/controllers/spree/current_order_tracking_spec.rb +2 -0
  47. data/spec/controllers/spree/home_controller_spec.rb +2 -0
  48. data/spec/controllers/spree/orders_controller_ability_spec.rb +2 -0
  49. data/spec/controllers/spree/orders_controller_spec.rb +2 -0
  50. data/spec/controllers/spree/orders_controller_transitions_spec.rb +2 -0
  51. data/spec/controllers/spree/products_controller_spec.rb +2 -0
  52. data/spec/controllers/spree/taxons_controller_spec.rb +2 -0
  53. data/spec/features/address_spec.rb +2 -0
  54. data/spec/features/automatic_promotion_adjustments_spec.rb +2 -0
  55. data/spec/features/caching/products_spec.rb +2 -8
  56. data/spec/features/caching/taxons_spec.rb +2 -2
  57. data/spec/features/cart_spec.rb +2 -0
  58. data/spec/features/checkout_spec.rb +7 -5
  59. data/spec/features/checkout_unshippable_spec.rb +3 -1
  60. data/spec/features/coupon_code_spec.rb +2 -0
  61. data/spec/features/currency_spec.rb +2 -0
  62. data/spec/features/free_shipping_promotions_spec.rb +2 -0
  63. data/spec/features/locale_spec.rb +3 -7
  64. data/spec/features/order_spec.rb +3 -1
  65. data/spec/features/products_spec.rb +4 -3
  66. data/spec/features/promotion_code_invalidation_spec.rb +2 -0
  67. data/spec/features/quantity_promotions_spec.rb +2 -0
  68. data/spec/features/taxons_spec.rb +2 -0
  69. data/spec/features/template_rendering_spec.rb +2 -0
  70. data/spec/generators/solidus/views/override_generator_spec.rb +2 -0
  71. data/spec/helpers/base_helper_spec.rb +2 -0
  72. data/spec/helpers/order_helper_spec.rb +2 -0
  73. data/spec/helpers/taxon_filters_helper_spec.rb +12 -0
  74. data/spec/spec_helper.rb +4 -2
  75. data/spec/support/shared_contexts/checkout_setup.rb +2 -0
  76. data/spec/support/shared_contexts/custom_products.rb +2 -0
  77. data/spec/support/shared_contexts/locales.rb +16 -0
  78. data/spec/views/spree/checkout/_summary_spec.rb +2 -0
  79. metadata +35 -28
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spree/frontend'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RakeUtil
2
4
  def self.add_marker(msg)
3
5
  puts "#" * 30 + " #{msg} " + '#' * 30
data/lib/tasks/taxon.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  namespace :spree do
2
4
  desc "Resets all taxon permalinks"
3
5
  task reset_taxon_permalinks: :environment do
data/script/rails CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
5
 
4
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
- ENGINE_PATH = File.expand_path('../../lib/spree/frontend/engine', __FILE__)
6
+ ENGINE_ROOT = File.expand_path('..', __dir__)
7
+ ENGINE_PATH = File.expand_path('../lib/spree/frontend/engine', __dir__)
6
8
 
7
9
  require 'rails/all'
8
10
  require 'rails/engine/commands'
@@ -1,4 +1,5 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
+
2
3
  require_relative '../core/lib/spree/core/version.rb'
3
4
 
4
5
  Gem::Specification.new do |s|
@@ -24,11 +25,11 @@ Gem::Specification.new do |s|
24
25
  s.add_dependency 'solidus_core', s.version
25
26
 
26
27
  s.add_dependency 'canonical-rails', '~> 0.2.0'
28
+ s.add_dependency 'font-awesome-rails', '~> 4.0'
27
29
  s.add_dependency 'jquery-rails'
30
+ s.add_dependency 'kaminari', '~> 1.1'
28
31
  s.add_dependency 'sass-rails'
29
- s.add_dependency 'font-awesome-rails', '~> 4.0'
30
32
  s.add_dependency 'truncate_html', '~> 0.9', '>= 0.9.2'
31
- s.add_dependency 'kaminari', '~> 1.1'
32
33
 
33
34
  s.add_development_dependency 'capybara-accessible'
34
35
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  # In this file, we want to test that the controller helpers function correctly
@@ -7,9 +9,13 @@ describe Spree::ProductsController, type: :controller do
7
9
  before do
8
10
  I18n.enforce_available_locales = false
9
11
  Spree::Frontend::Config[:locale] = :de
12
+ I18n.backend.store_translations(:de, spree: {
13
+ i18n: { this_file_language: "Deutsch (DE)" }
14
+ })
10
15
  end
11
16
 
12
17
  after do
18
+ I18n.reload!
13
19
  Spree::Frontend::Config[:locale] = :en
14
20
  I18n.locale = :en
15
21
  I18n.enforce_available_locales = true
@@ -0,0 +1,57 @@
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Spree::CheckoutController, type: :controller do
@@ -1,4 +1,5 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  # This spec is useful for when we just want to make sure a view is rendering correctly
@@ -22,7 +23,7 @@ describe Spree::CheckoutController, type: :controller do
22
23
  before do
23
24
  # Using a let block won't acknowledge the currency setting
24
25
  # Therefore we just do it like this...
25
- order = OrderWalkthrough.up_to(:address)
26
+ order = Spree::TestingSupport::OrderWalkthrough.up_to(:address)
26
27
  allow(controller).to receive_messages current_order: order
27
28
  end
28
29
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  describe Spree::ContentController, type: :controller do
3
5
  it "should display CVV page" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe 'current order tracking', type: :controller do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Spree::HomeController, type: :controller do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Spree
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Spree::OrdersController, type: :controller do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  Spree::Order.class_eval do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Spree::ProductsController, type: :controller do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Spree::TaxonsController, type: :controller do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "Address", type: :feature, inaccessible: true do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "Automatic promotions", type: :feature, js: true do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe 'products', type: :feature, caching: true do
@@ -10,9 +12,6 @@ describe 'products', type: :feature, caching: true do
10
12
  product2.update_column(:updated_at, 1.day.ago)
11
13
  # warm up the cache
12
14
  visit spree.root_path
13
- assert_written_to_cache("views/en/USD/spree/products/all--#{product.updated_at.utc.to_s(:number)}")
14
- assert_written_to_cache("views/en/USD/spree/products/#{product.id}-#{product.updated_at.utc.to_s(:number)}")
15
- assert_written_to_cache("views/en/spree/taxonomies/#{taxonomy.id}")
16
15
 
17
16
  clear_cache_events
18
17
  end
@@ -25,8 +24,6 @@ describe 'products', type: :feature, caching: true do
25
24
  it "busts the cache when a product is updated" do
26
25
  product.update_column(:updated_at, 1.day.from_now)
27
26
  visit spree.root_path
28
- assert_written_to_cache("views/en/USD/spree/products/all--#{product.updated_at.utc.to_s(:number)}")
29
- assert_written_to_cache("views/en/USD/spree/products/#{product.id}-#{product.updated_at.utc.to_s(:number)}")
30
27
  expect(cache_writes.count).to eq(2)
31
28
  end
32
29
 
@@ -34,21 +31,18 @@ describe 'products', type: :feature, caching: true do
34
31
  product.discard
35
32
  product2.discard
36
33
  visit spree.root_path
37
- assert_written_to_cache("views/en/USD/spree/products/all--#{Date.today.to_s(:number)}-0")
38
34
  expect(cache_writes.count).to eq(1)
39
35
  end
40
36
 
41
37
  it "busts the cache when the newest product is soft-deleted" do
42
38
  product.discard
43
39
  visit spree.root_path
44
- assert_written_to_cache("views/en/USD/spree/products/all--#{product2.updated_at.utc.to_s(:number)}")
45
40
  expect(cache_writes.count).to eq(1)
46
41
  end
47
42
 
48
43
  it "busts the cache when an older product is soft-deleted" do
49
44
  product2.discard
50
45
  visit spree.root_path
51
- assert_written_to_cache("views/en/USD/spree/products/all--#{product.updated_at.utc.to_s(:number)}")
52
46
  expect(cache_writes.count).to eq(1)
53
47
  end
54
48
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe 'taxons', type: :feature, caching: true do
@@ -7,7 +9,6 @@ describe 'taxons', type: :feature, caching: true do
7
9
  before do
8
10
  # warm up the cache
9
11
  visit spree.root_path
10
- assert_written_to_cache("views/en/spree/taxonomies/#{taxonomy.id}")
11
12
 
12
13
  clear_cache_events
13
14
  end
@@ -15,7 +16,6 @@ describe 'taxons', type: :feature, caching: true do
15
16
  it "busts the cache when max_level_in_taxons_menu conf changes" do
16
17
  Spree::Config[:max_level_in_taxons_menu] = 5
17
18
  visit spree.root_path
18
- assert_written_to_cache("views/en/spree/taxonomies/#{taxonomy.id}")
19
19
  expect(cache_writes.count).to eq(1)
20
20
  end
21
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "Cart", type: :feature, inaccessible: true do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "Checkout", type: :feature, inaccessible: true do
@@ -213,7 +215,7 @@ describe "Checkout", type: :feature, inaccessible: true do
213
215
  context "doesn't allow bad credit card numbers" do
214
216
  let!(:payment_method) { create(:credit_card_payment_method) }
215
217
  before(:each) do
216
- order = OrderWalkthrough.up_to(:delivery)
218
+ order = Spree::TestingSupport::OrderWalkthrough.up_to(:delivery)
217
219
 
218
220
  user = create(:user)
219
221
  order.user = user
@@ -241,7 +243,7 @@ describe "Checkout", type: :feature, inaccessible: true do
241
243
  let!(:user) { create(:user) }
242
244
 
243
245
  let!(:order) do
244
- order = OrderWalkthrough.up_to(:delivery)
246
+ order = Spree::TestingSupport::OrderWalkthrough.up_to(:delivery)
245
247
 
246
248
  order.reload
247
249
  order.user = user
@@ -289,7 +291,7 @@ describe "Checkout", type: :feature, inaccessible: true do
289
291
 
290
292
  before do
291
293
  Capybara.ignore_hidden_elements = false
292
- order = OrderWalkthrough.up_to(:delivery)
294
+ order = Spree::TestingSupport::OrderWalkthrough.up_to(:delivery)
293
295
  allow(order).to receive_messages(available_payment_methods: [check_payment, credit_cart_payment])
294
296
  order.user = create(:user)
295
297
  order.recalculate
@@ -324,7 +326,7 @@ describe "Checkout", type: :feature, inaccessible: true do
324
326
 
325
327
  before do
326
328
  user.wallet.add(credit_card)
327
- order = OrderWalkthrough.up_to(:delivery)
329
+ order = Spree::TestingSupport::OrderWalkthrough.up_to(:delivery)
328
330
 
329
331
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
330
332
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
@@ -566,7 +568,7 @@ describe "Checkout", type: :feature, inaccessible: true do
566
568
 
567
569
  context "when order is completed" do
568
570
  let!(:user) { create(:user) }
569
- let!(:order) { OrderWalkthrough.up_to(:delivery) }
571
+ let!(:order) { Spree::TestingSupport::OrderWalkthrough.up_to(:delivery) }
570
572
 
571
573
  before(:each) do
572
574
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "checkout with unshippable items", type: :feature, inaccessible: true do
4
6
  let!(:stock_location) { create(:stock_location) }
5
- let(:order) { OrderWalkthrough.up_to(:address) }
7
+ let(:order) { Spree::TestingSupport::OrderWalkthrough.up_to(:address) }
6
8
 
7
9
  before do
8
10
  create(:line_item, order: order)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "Coupon code promotions", type: :feature, js: true do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "Switching currencies in backend", type: :feature do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "Free shipping promotions", type: :feature, js: true do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe 'setting locale', type: :feature do
@@ -12,13 +14,7 @@ describe 'setting locale', type: :feature do
12
14
  end
13
15
 
14
16
  context 'shopping cart link and page' do
15
- before do
16
- I18n.backend.store_translations(:fr,
17
- spree: {
18
- cart: 'Panier',
19
- shopping_cart: 'Panier'
20
- })
21
- end
17
+ include_context "fr locale"
22
18
 
23
19
  it 'should be in french' do
24
20
  with_locale('fr') do
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe 'orders', type: :feature do
4
- let(:order) { OrderWalkthrough.up_to(:complete) }
6
+ let(:order) { Spree::TestingSupport::OrderWalkthrough.up_to(:complete) }
5
7
  let(:user) { create(:user) }
6
8
 
7
9
  before do
@@ -1,4 +1,5 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  describe "Visiting Products", type: :feature, inaccessible: true do
@@ -153,7 +154,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
153
154
 
154
155
  before do
155
156
  # Need to have two images to trigger the error
156
- image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
157
+ image = File.open(File.expand_path('../fixtures/thinking-cat.jpg', __dir__))
157
158
  product.images.create!(attachment: image)
158
159
  product.images.create!(attachment: image)
159
160
 
@@ -183,7 +184,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
183
184
  let(:product) { Spree::Product.find_by(name: "Ruby on Rails Baseball Jersey") }
184
185
 
185
186
  before do
186
- image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
187
+ image = File.open(File.expand_path('../fixtures/thinking-cat.jpg', __dir__))
187
188
  v1 = product.variants.create!(price: 9.99)
188
189
  v2 = product.variants.create!(price: 10.99)
189
190
  v1.images.create!(attachment: image)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.feature "Promotion Code Invalidation" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.feature "Quantity Promotions" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "viewing products", type: :feature, inaccessible: true do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "Template rendering", type: :feature do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'generator_spec'
3
5
  require 'generators/solidus/views/override_generator'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Spree
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Spree
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Spree::TaxonFiltersHelper, type: :helper do
6
+ let(:taxon) { nil }
7
+ subject { applicable_filters_for(taxon) }
8
+
9
+ it "returns the price/brand filters" do
10
+ expect(subject.map { |y| y[:name] }).to eq ['Brands', 'Price Range']
11
+ end
12
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if ENV["COVERAGE"]
2
4
  require 'simplecov'
3
5
  SimpleCov.start('rails')
@@ -10,7 +12,7 @@ ENV["RAILS_ENV"] ||= 'test'
10
12
  require 'solidus_frontend'
11
13
  require 'spree/testing_support/dummy_app'
12
14
  DummyApp.setup(
13
- gem_root: File.expand_path('../../', __FILE__),
15
+ gem_root: File.expand_path('..', __dir__),
14
16
  lib_name: 'solidus_frontend'
15
17
  )
16
18
 
@@ -53,7 +55,7 @@ RSpec.configure do |config|
53
55
  c.syntax = :expect
54
56
  end
55
57
 
56
- config.fixture_path = File.join(File.expand_path(File.dirname(__FILE__)), "fixtures")
58
+ config.fixture_path = File.join(__dir__, "fixtures")
57
59
 
58
60
  # If you're not using ActiveRecord, or you'd prefer not to run each of your
59
61
  # examples within a transaction, comment the following line or assign false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  shared_context 'checkout setup' do
2
4
  let!(:store) { create(:store) }
3
5
  let!(:country) { create(:country, states_required: true) }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  shared_context "custom products" do
2
4
  before(:each) do
3
5
  create(:store)
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ shared_context 'fr locale' do
4
+ before do
5
+ I18n.backend.store_translations(:fr, spree: {
6
+ i18n: { this_file_language: "Français" },
7
+ cart: 'Panier',
8
+ shopping_cart: 'Panier'
9
+ })
10
+ end
11
+
12
+ after do
13
+ I18n.locale = :en # reset locale after each spec.
14
+ I18n.reload!
15
+ end
16
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "spree/checkout/_summary.html.erb", type: :view do