From 219ff436399c3d28bb09ea841fecfdcfe6606257 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 10 Mar 2012 17:24:36 -0300 Subject: Disable template, helper and assets options when using http_only! [Carlos Antonio da Silva & Santiago Pastorino] --- railties/test/generators_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'railties/test') 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 -- cgit v1.2.3