Sha256: e4982549c398d844f721688d604b3a9ce94f46606e51e75bf1b98fa42085930a

Contents?: true

Size: 967 Bytes

Versions: 34

Compression:

Stored size: 967 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Spree::TestingSupport::Preferences do
  describe 'resetting the app configuration' do
    before do
      @original_spree_mails_from = Spree::Config.mails_from
      @original_spree_searcher_class = Spree::Config.searcher_class
      class MySearcherClass; end
      include Spree::TestingSupport::Preferences
      Spree::Config.mails_from = "hello@myserver.com"
      Spree::Config.searcher_class = MySearcherClass
    end

    it 'resets normal preferences' do
      expect(Spree::Config.mails_from).to eq("hello@myserver.com")
      reset_spree_preferences
      expect(Spree::Config.mails_from).to eq(@original_spree_mails_from)
    end

    it 'resets cached configuration instance variables' do
      expect(Spree::Config.searcher_class).to eq(MySearcherClass)
      reset_spree_preferences
      expect(Spree::Config.searcher_class).to eq(@original_spree_searcher_class)
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
solidus_core-2.8.6 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.6.6 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.7.4 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.8.5 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.7.3 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.6.5 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.8.4 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.8.3 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.7.2 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.6.4 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.8.2 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.8.1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.6.3 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.8.0 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.7.1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.6.2 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.14 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.13 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.12 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.11 spec/lib/spree/core/testing_support/preferences_spec.rb