Sha256: 421ed84b3789a0bbcf92b7cdd45961d71fd768037fb2e8893ee1ae314113aec7

Contents?: true

Size: 948 Bytes

Versions: 9

Compression:

Stored size: 948 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.site_name = "my fancy pants store"
      # end
      #
      def reset_spree_preferences(&config_block)
        Spree::Preferences::Store.instance.persistence = false
        Spree::Preferences::Store.instance.clear_cache

        config = Rails.application.config.spree.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

9 entries across 9 versions & 1 rubygems

Version Path
spree_core-2.2.14 lib/spree/testing_support/preferences.rb
spree_core-2.2.13 lib/spree/testing_support/preferences.rb
spree_core-2.2.12 lib/spree/testing_support/preferences.rb
spree_core-2.2.11 lib/spree/testing_support/preferences.rb
spree_core-2.2.10 lib/spree/testing_support/preferences.rb
spree_core-2.2.9 lib/spree/testing_support/preferences.rb
spree_core-2.2.8 lib/spree/testing_support/preferences.rb
spree_core-2.2.7 lib/spree/testing_support/preferences.rb
spree_core-2.2.6 lib/spree/testing_support/preferences.rb