/spree_config_preferences

Primary LanguageRubyBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

SpreeConfigPreferences

This extension overrides Spree's default behavior of saving and loading application preferences in the database.

Installation

Add spree_config_preferences to your Gemfile:

gem 'spree_config_preferences'

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_config_preferences:install

Replace reference to Spree::Preferences::Store.instance in Spree to Spree::Preferences::InMemoryStore.instance.

To load the configuration settings into the InMemoryStore instance, define the configuration files you wish to load in application.rb.

config.spree_config_preferences_preference_files = [ABSOLUTE_FILEPATH, SECOND_ABSOLUTE_FILEPATH]
config.spree_config_preferences_model_preference_files = [ABSOLUTE_FILEPATH, SECOND_ABSOLUTE_FILEPATH]
config.spree_config_preferences_environment_agnostic_preference_files = [ABSOLUTE_FILEPATH, SECOND_ABSOLUTE_FILEPATH]

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree_config_preferences/factories'

Copyright (c) 2014 [Bonobos], released under the New BSD License