Sha256: 1c4df1d23f3fc9b0d4304578c099d347574aa77356c529bf45a3b00a312834fe

Contents?: true

Size: 842 Bytes

Versions: 28

Compression:

Stored size: 842 Bytes

Contents

module Spree
  module TestingSupport
    module Preferences
      # Resets all preferences to default values, you can
      # pass a block to override the defaults with a block
      #
      # reset_spree_preferences do |config|
      #   config.track_inventory_levels = false
      # end
      #
      def reset_spree_preferences(&config_block)
        Spree::Config.preference_store = Spree::Config.default_preferences

        configure_spree_preferences(&config_block) if block_given?
      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

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
solidus_core-1.2.3 lib/spree/testing_support/preferences.rb
solidus_core-1.1.4 lib/spree/testing_support/preferences.rb
solidus_core-1.0.7 lib/spree/testing_support/preferences.rb
solidus_core-1.0.6 lib/spree/testing_support/preferences.rb
solidus_core-1.2.2 lib/spree/testing_support/preferences.rb
solidus_core-1.2.1 lib/spree/testing_support/preferences.rb
solidus_core-1.1.3 lib/spree/testing_support/preferences.rb
solidus_core-1.0.5 lib/spree/testing_support/preferences.rb
solidus_core-1.2.0 lib/spree/testing_support/preferences.rb
solidus_core-1.2.0.rc2 lib/spree/testing_support/preferences.rb
solidus_core-1.0.4 lib/spree/testing_support/preferences.rb
solidus_core-1.1.2 lib/spree/testing_support/preferences.rb
solidus_core-1.2.0.rc1 lib/spree/testing_support/preferences.rb
solidus_core-1.2.0.beta1 lib/spree/testing_support/preferences.rb
solidus_core-1.0.3 lib/spree/testing_support/preferences.rb
solidus_core-1.1.1 lib/spree/testing_support/preferences.rb
solidus_core-1.1.0 lib/spree/testing_support/preferences.rb
solidus_core-1.1.0.pre2 lib/spree/testing_support/preferences.rb
solidus_core-1.1.0.pre1 lib/spree/testing_support/preferences.rb
solidus_core-1.1.0.beta1 lib/spree/testing_support/preferences.rb