Skip to content
This repository
Browse code

Allow generator configs from http_only! to be overriden by app

[Carlos Antonio da Silva & Santiago Pastorino]
  • Loading branch information...
commit ff8e9e07b445a020faa4adf8e94b6d9328f2f1de 1 parent 2b35575
Carlos Antonio da Silva carlosantoniodasilva authored spastorino committed
2  railties/lib/rails/generators.rb
@@ -61,6 +61,7 @@ module Generators
61 61 }
62 62
63 63 def self.configure!(config) #:nodoc:
  64 + http_only! if config.http_only?
64 65 no_color! unless config.colorize_logging
65 66 aliases.deep_merge! config.aliases
66 67 options.deep_merge! config.options
@@ -68,7 +69,6 @@ def self.configure!(config) #:nodoc:
68 69 templates_path.concat config.templates
69 70 templates_path.uniq!
70 71 hide_namespaces(*config.hidden_namespaces)
71   - http_only! if config.http_only?
72 72 end
73 73
74 74 def self.templates_path
15 railties/test/application/generators_test.rb
@@ -125,5 +125,20 @@ def with_bare_config
125 125 assert_equal expected, c.generators.options
126 126 end
127 127 end
  128 +
  129 + test "http only allow overriding generators on initialization" do
  130 + add_to_config <<-RUBY
  131 + config.generators.helper = true
  132 + config.generators.http_only!
  133 + config.generators.template_engine = :my_template
  134 + RUBY
  135 +
  136 + # Initialize the application
  137 + require "#{app_path}/config/environment"
  138 + Rails.application.load_generators
  139 +
  140 + assert_equal :my_template, Rails::Generators.options[:rails][:template_engine]
  141 + assert_equal true, Rails::Generators.options[:rails][:helper]
  142 + end
128 143 end
129 144 end

0 comments on commit ff8e9e0

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