Skip to content
Browse files

Allow generator configs from http_only! to be overriden by app

[Carlos Antonio da Silva & Santiago Pastorino]
  • Loading branch information...
1 parent 2b35575 commit ff8e9e07b445a020faa4adf8e94b6d9328f2f1de @carlosantoniodasilva carlosantoniodasilva committed with spastorino Mar 10, 2012
Showing with 16 additions and 1 deletion.
  1. +1 −1 railties/lib/rails/generators.rb
  2. +15 −0 railties/test/application/generators_test.rb
View
2 railties/lib/rails/generators.rb
@@ -61,14 +61,14 @@ module Generators
}
def self.configure!(config) #:nodoc:
+ http_only! if config.http_only?
no_color! unless config.colorize_logging
aliases.deep_merge! config.aliases
options.deep_merge! config.options
fallbacks.merge! config.fallbacks
templates_path.concat config.templates
templates_path.uniq!
hide_namespaces(*config.hidden_namespaces)
- http_only! if config.http_only?
end
def self.templates_path
View
15 railties/test/application/generators_test.rb
@@ -125,5 +125,20 @@ def with_bare_config
assert_equal expected, c.generators.options
end
end
+
+ test "http only allow overriding generators on initialization" do
+ add_to_config <<-RUBY
+ config.generators.helper = true
+ config.generators.http_only!
+ config.generators.template_engine = :my_template
+ RUBY
+
+ # Initialize the application
+ require "#{app_path}/config/environment"
+ Rails.application.load_generators
+
+ assert_equal :my_template, Rails::Generators.options[:rails][:template_engine]
+ assert_equal true, Rails::Generators.options[:rails][:helper]
+ end
end
end

0 comments on commit ff8e9e0

Please sign in to comment.
Something went wrong with that request. Please try again.