Sha256: 158cb0e9d6a97514529d7154abf2c255b054d82e28cc01828a09ae9cc62ac2b0

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

# In this file, we want to test that the controller helpers function correctly
# So we need to use one of the controllers inside Spree.
# ProductsController is good.
describe Spree::ProductsController, type: :controller do
  before do
    I18n.enforce_available_locales = false
    stub_spree_preferences(SolidusStarterFrontend::Config, locale: :de)
    I18n.backend.store_translations(:de, spree: {
      i18n: { this_file_language: "Deutsch (DE)" }
    })
  end

  after do
    I18n.reload!
    I18n.locale = :en
    I18n.enforce_available_locales = true
  end

  # Regression test for https://github.com/spree/spree/issues/1184
  it "sets the default locale based off SolidusStarterFrontend::Config[:locale]" do
    expect(I18n.locale).to eq(:en)
    get :index
    expect(I18n.locale).to eq(:de)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_starter_frontend-0.1.0 spec/controllers/controller_helpers_spec.rb