Sha256: 96c3474fb0ee8a970cd8192333ce2e173765d0e599b6b3b2f208ede2ea534a8c

Contents?: true

Size: 939 Bytes

Versions: 32

Compression:

Stored size: 939 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.instance_variables.each { |iv| Spree::Config.remove_instance_variable(iv) }
        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

32 entries across 32 versions & 1 rubygems

Version Path
solidus_core-2.1.0.beta1 lib/spree/testing_support/preferences.rb
solidus_core-2.0.0 lib/spree/testing_support/preferences.rb
solidus_core-1.4.0 lib/spree/testing_support/preferences.rb
solidus_core-2.0.0.rc1 lib/spree/testing_support/preferences.rb
solidus_core-1.4.0.rc1 lib/spree/testing_support/preferences.rb
solidus_core-2.0.0.beta1 lib/spree/testing_support/preferences.rb
solidus_core-1.4.0.beta1 lib/spree/testing_support/preferences.rb
solidus_core-1.3.1 lib/spree/testing_support/preferences.rb
solidus_core-1.3.0 lib/spree/testing_support/preferences.rb
solidus_core-1.3.0.rc2 lib/spree/testing_support/preferences.rb
solidus_core-1.3.0.rc1 lib/spree/testing_support/preferences.rb
solidus_core-1.3.0.beta1 lib/spree/testing_support/preferences.rb