Module: Spree::Core::TestingSupport::Preferences

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

Instance Method Summary collapse

Instance Method Details

#assert_preference_unset(preference) ⇒ Object



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

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

#reset_spree_preferences {|config| ... } ⇒ 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.site_name = "my fancy pants store"

end

Yields:

  • (config)


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

def reset_spree_preferences
  Spree::Preferences::Store.instance.persistence = false
  config = Rails.application.config.spree.preferences
  config.reset
  yield(config) if block_given?
end