Use application's generators defaults as engine defaults to not force users to manually set it
This commit is contained in:
parent
9e86767bb8
commit
cfbe595831
@ -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"
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user