Skip to content

Commit

Permalink
Use application's generators defaults as engine defaults to not force…
Browse files Browse the repository at this point in the history
… users to manually set it
  • Loading branch information
drogus committed Nov 2, 2010
1 parent 9e86767 commit cfbe595
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/railtie.rb
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions railties/lib/rails/engine/configuration.rb
Expand Up @@ -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.
Expand Down
17 changes: 17 additions & 0 deletions railties/test/railties/engine_test.rb
Expand Up @@ -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

0 comments on commit cfbe595

Please sign in to comment.