Module: Spree::TestingSupport::Preferences

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

Instance Method Summary collapse

Instance Method Details

#assert_preference_unset(preference) ⇒ Object



21
22
23
24
# File 'lib/spree/testing_support/preferences.rb', line 21

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

#configure_spree_preferences {|config| ... } ⇒ Object

Yields:

  • (config)


16
17
18
19
# File 'lib/spree/testing_support/preferences.rb', line 16

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

#reset_spree_preferences(&config_block) ⇒ Object

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
# File 'lib/spree/testing_support/preferences.rb', line 11

def reset_spree_preferences(&config_block)
  config = Rails.application.config.spree.preferences.reset
  configure_spree_preferences &config_block if block_given?
end