Module: Spree::TestingSupport::Preferences Private

Defined in:
lib/spree/testing_support/preferences.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary (collapse)

Instance Method Details

- (Object) assert_preference_unset(preference)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
# File 'lib/spree/testing_support/preferences.rb', line 23

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

- (Object) configure_spree_preferences {|config| ... }

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Yields:



18
19
20
21
# File 'lib/spree/testing_support/preferences.rb', line 18

def configure_spree_preferences
  config = Rails.application.config.spree.preferences
  yield(config) if block_given?
end

- (Object) reset_spree_preferences(&config_block)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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



11
12
13
14
15
16
# File 'lib/spree/testing_support/preferences.rb', line 11

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