Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use application's generators defaults as engine defaults to not force…

… users to manually set it
  • Loading branch information...
commit cfbe5958311f21397c98657c3370d03dcf720fe1 1 parent 9e86767
@drogus drogus authored
View
2  activerecord/lib/active_record/railtie.rb
@@ -14,7 +14,7 @@ class Railtie < Rails::Railtie
config.active_record = ActiveSupport::OrderedOptions.new
config.app_generators.orm :active_record, :migration => true,
- :timestamps => true
+ :timestamps => true
config.app_middleware.insert_after "::ActionDispatch::Callbacks",
"ActiveRecord::QueryCache"
View
1  railties/lib/rails/engine/configuration.rb
@@ -10,6 +10,7 @@ class Configuration < ::Rails::Railtie::Configuration
def initialize(root=nil)
super()
@root = root
+ @generators = app_generators
end
# Returns the middleware stack for the engine.
View
17 railties/test/railties/engine_test.rb
@@ -685,5 +685,22 @@ class Engine < ::Rails::Engine
assert_equal :haml , generators[:template_engine]
assert_equal :rspec , generators[:test_framework]
end
+
+ test "engine should get default generators with ability to overwrite them" do
+ @plugin.write "lib/bukkits.rb", <<-RUBY
+ module Bukkits
+ class Engine < ::Rails::Engine
+ config.generators.test_framework :rspec
+ end
+ end
+ RUBY
+
+ boot_rails
+ require "#{rails_root}/config/environment"
+
+ generators = Bukkits::Engine.config.generators.options[:rails]
+ assert_equal :active_record, generators[:orm]
+ assert_equal :rspec , generators[:test_framework]
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.