Sha256: 5f4cd57da46e88bbd53b5b42ff83072ca83d96b10c0981e98000fbbde47a4e42

Contents?: true

Size: 1001 Bytes

Versions: 5

Compression:

Stored size: 1001 Bytes

Contents

module Spree
  module Core
    module TestingSupport
      module Preferences
        def reset_spree_preferences(&config_block)
          Spree::Preferences::Store.instance.persistence = false
          Spree::Preferences::Store.instance.clear_cache

          configure_spree_preferences &config_block if block_given?
        end

        # The preference cache is cleared before each test, so the
        # default values will be used. You can define preferences
        # for your spec with:
        #
        # configure_spree_preferences do |config|
        #   config.site_name = "my fancy pants store"
        # end
        #
        def configure_spree_preferences
          config = Rails.application.config.spree.preferences
          yield(config) if block_given?
        end

        def assert_preference_unset(preference)
          find("#preferences_#{preference}")['checked'].should be_false
          Spree::Config[preference].should be_false
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spree_core-1.3.5 lib/spree/core/testing_support/preferences.rb
spree_core-1.3.4 lib/spree/core/testing_support/preferences.rb
spree_core-1.3.3 lib/spree/core/testing_support/preferences.rb
spree_core-1.2.5 lib/spree/core/testing_support/preferences.rb
spree_core-1.3.2 lib/spree/core/testing_support/preferences.rb