module Spree::TestingSupport::Preferences
Public Instance Methods
assert_preference_unset(preference)
click to toggle source
# File lib/spree/testing_support/preferences.rb, line 24 def assert_preference_unset(preference) find("#preferences_#{preference}")['checked'].should be false Spree::Config[preference].should be false end
configure_spree_preferences() { |config| ... }
click to toggle source
# File lib/spree/testing_support/preferences.rb, line 19 def configure_spree_preferences config = Rails.application.config.spree.preferences yield(config) if block_given? end
reset_spree_preferences(&config_block)
click to toggle source
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
# File lib/spree/testing_support/preferences.rb, line 11 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