lib/rails_helper.rb in rails_helper-1.0.0 vs lib/rails_helper.rb in rails_helper-1.1.0

- old
+ new

@@ -1,18 +1,28 @@ class Helper - def Helper.version() '1.0.0' end + def Helper.version() '1.1.0' end def Helper.dependencies { 'rails_current' => [ 'rails_current', ' >= 1.0' ] } end - if defined?(Rails) - url_helpers = Rails.application.try(:routes).try(:url_helpers) - include(url_helpers) if url_helpers - include(ActionView::Helpers) if defined?(ActionView::Helpers) + if defined?(Rails::Engine) + + class Engine < Rails::Engine + config.after_initialize do + if defined?(ActionView::Helpers) + ::Helper.send(:include, ActionView::Helpers) + end + + if defined?(Rails.application.routes.url_helpers) + ::Helper.send(:include, Rails.application.routes.url_helpers) + end + end + end + end def controller @controller ||= (Helper.current_controller || Helper.mock_controller) @controller