aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-03-10 18:19:01 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2012-03-14 12:46:24 -0300
commitff8e9e07b445a020faa4adf8e94b6d9328f2f1de (patch)
tree4535cb04302bb0a9962430b4d25e83722fe3e7ef /railties
parent2b355757d5485beb42a4184e28621d86daced862 (diff)
downloadrails-ff8e9e07b445a020faa4adf8e94b6d9328f2f1de.tar.gz
rails-ff8e9e07b445a020faa4adf8e94b6d9328f2f1de.tar.bz2
rails-ff8e9e07b445a020faa4adf8e94b6d9328f2f1de.zip
Allow generator configs from http_only! to be overriden by app
[Carlos Antonio da Silva & Santiago Pastorino]
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators.rb2
-rw-r--r--railties/test/application/generators_test.rb15
2 files changed, 16 insertions, 1 deletions
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb
index f70c9ebab9..8d66cd2fd3 100644
--- a/railties/lib/rails/generators.rb
+++ b/railties/lib/rails/generators.rb
@@ -61,6 +61,7 @@ module Rails
}
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
@@ -68,7 +69,6 @@ module Rails
templates_path.concat config.templates
templates_path.uniq!
hide_namespaces(*config.hidden_namespaces)
- http_only! if config.http_only?
end
def self.templates_path
diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb
index bf58bb3f74..7ebb68152f 100644
--- a/railties/test/application/generators_test.rb
+++ b/railties/test/application/generators_test.rb
@@ -125,5 +125,20 @@ module ApplicationTests
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