diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-03-10 17:24:36 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-03-14 12:46:24 -0300 |
commit | 219ff436399c3d28bb09ea841fecfdcfe6606257 (patch) | |
tree | 9752058046c2614be445038c34c9c8f904db82fd /railties/test/generators_test.rb | |
parent | c825e9a5eaa8060a3745c5275b6829c37c6545a7 (diff) | |
download | rails-219ff436399c3d28bb09ea841fecfdcfe6606257.tar.gz rails-219ff436399c3d28bb09ea841fecfdcfe6606257.tar.bz2 rails-219ff436399c3d28bb09ea841fecfdcfe6606257.zip |
Disable template, helper and assets options when using http_only!
[Carlos Antonio da Silva & Santiago Pastorino]
Diffstat (limited to 'railties/test/generators_test.rb')
-rw-r--r-- | railties/test/generators_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 44797a6ac8..eae34da9c0 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -229,6 +229,22 @@ class GeneratorsTest < Rails::Generators::TestCase end end + def test_http_only_disables_template_and_helper_and_assets_options + options = Rails::Generators.options[:rails] + disable_options = [:assets, :helper, :javascripts, :javascript_engine, + :stylesheets, :stylesheet_engine, :template_engine] + + disable_options.each do |disable_option| + assert options[disable_option], "without http only should have generator option #{disable_option} enabled" + end + + with_http_only! do + disable_options.each do |disable_option| + assert !options[disable_option], "http only should have generator option #{disable_option} disabled" + end + end + end + private def with_http_only! @@ -236,5 +252,7 @@ class GeneratorsTest < Rails::Generators::TestCase yield ensure Rails::Generators.instance_variable_set(:@http_only, false) + Rails::Generators.instance_variable_set(:@hidden_namespaces, nil) + Rails::Generators.instance_variable_set(:@options, nil) end end |