README.md in solidus_support-0.3.3 vs README.md in solidus_support-0.4.0

- old
+ new

@@ -22,64 +22,40 @@ SolidusSupport::Migration[5.0] # same as `ActiveRecord::Migration[5.0]` ``` There's no reason to use `SolidusSupport::Migration[5.0]` over `ActiveRecord::Migration[5.0]`, but it is provided. -### Testing Helpers +### Engine Extensions -This gem provides some useful helpers for RSpec to setup an extension's test -environment easily. +This extension provides a module that extends `Rails::Engine` functionalities +to support loading correctly the decorators class created into an extension +both for development and production enviroments. -Into your extension's spec/spec_helper.rb: +To use it just include the provided module in the Engine as follow: ```ruby -require "solidus_support/extension/feature_helper" -``` +module SolidusExtensionName + class Engine < Rails::Engine + engine_name 'solidus_extension_name' -This helper loads configuration needed to run extensions feature specs -correctly, setting up Capybara and configuring Rails test application -to precompile assets before the first feature spec. - -This helper requires the `rails_helper`, also provided by this gem and -requireable as a stand-alone helper. - -By doing: - -```ruby -require "solidus_support/extension/rails_helper" + include SolidusSupport::EngineExtensions::Decorators + # ... + end +end ``` -extension's test suite will have all Rails related tests configuration, -like authorization helpers, Solidus core factories, url helpers, and -other helpers to easily work with Solidus Config. +To make it work, be sure to remove the previous implementation from the +Engine, that should be something like: -This `rails_helper` in turn requires the basic `spec_helper`, which is -responsible to load a basic RSpec configuration, which could be needed -in all extensions. It is also requireable as a stand-alone helper with: - ```ruby -require "solidus_support/extension/spec_helper" -``` +def self.activate + Dir.glob(File.join(root, "app/**/*_decorator*.rb")) do |c| + Rails.configuration.cache_classes ? require(c) : load(c) + end +end -### Coverage Collection - -The gem also includes a SimpleCov configuration that will send your test -coverage information directly to Codecov.io. Simply add this at the top -of your `spec/spec_helper.rb`: - -```ruby -require "solidus_support/extension/coverage" +config.to_prepare(&method(:activate).to_proc) ``` - -**Note: Make sure to add this at the VERY TOP of your spec_helper, -otherwise you'll get skewed coverage reports!** - -If your extension is in a public repo and being tested on Travis or -CircleCI, there's nothing else you need to do - you'll get coverage -reports for free! - -If your setup is more complex, look at the [SimpleCov](https://github.com/colszowka/simplecov) -and [codecov-ruby](https://github.com/codecov/codecov-ruby) docs. ## Development After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.