Sha256: 9849069e9d01d8be27ddfc9a9b2f40c79a2ca4e880e193757effb4bc595e04a0

Contents?: true

Size: 935 Bytes

Versions: 32

Compression:

Stored size: 935 Bytes

Contents

require 'spec_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

32 entries across 32 versions & 1 rubygems

Version Path
solidus_core-2.3.1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.2.2 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.1.1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.0.3 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-1.4.2 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-1.3.2 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.3.0 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.3.0.rc3 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.3.0.rc2 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.3.0.rc1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.3.0.beta1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.0.2 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-1.4.1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.2.1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.2.0 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.2.0.rc1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.2.0.beta1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.1.0 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.1.0.rc1 spec/lib/spree/core/testing_support/preferences_spec.rb
solidus_core-2.0.1 spec/lib/spree/core/testing_support/preferences_spec.rb