aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators_test.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-03-13 10:03:59 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2012-03-14 12:46:25 -0300
commit570cc89bad00a0df20e11196fa34d3119327a7d6 (patch)
treedcec69b0a6fa60bdde8a3cb5a5b5375c93a6be7a /railties/test/generators_test.rb
parent3e138df9776985de8ab367dcd9757b404c53435e (diff)
downloadrails-570cc89bad00a0df20e11196fa34d3119327a7d6.tar.gz
rails-570cc89bad00a0df20e11196fa34d3119327a7d6.tar.bz2
rails-570cc89bad00a0df20e11196fa34d3119327a7d6.zip
Generate special controller and functional test templates for http apps
The main goal is to not generate the format.html block in scaffold controller, and to generate a different functional test as we don't rely on redirects anymore, we should test for http responses. In addition to that, the :edit action is removed from the http controller and the edit route is not generated by default, as they usually do not make sense in this scenario. [Carlos Antonio da Silva & Santiago Pastorino]
Diffstat (limited to 'railties/test/generators_test.rb')
-rw-r--r--railties/test/generators_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb
index eae34da9c0..9e7ec86fdf 100644
--- a/railties/test/generators_test.rb
+++ b/railties/test/generators_test.rb
@@ -229,6 +229,16 @@ class GeneratorsTest < Rails::Generators::TestCase
end
end
+ def test_http_only_enables_http_option
+ options = Rails::Generators.options[:rails]
+
+ assert !options[:http], "http option should be disabled by default"
+
+ with_http_only! do
+ assert options[:http], "http only should enable generator http option"
+ 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,
@@ -251,7 +261,6 @@ class GeneratorsTest < Rails::Generators::TestCase
Rails::Generators.http_only!
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