aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.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/lib/rails/generators/test_unit/scaffold/scaffold_generator.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/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb')
-rw-r--r--railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb
index 37b9f7ef7d..e875c81340 100644
--- a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb
+++ b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb
@@ -10,8 +10,13 @@ module TestUnit
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
+ class_option :http, :type => :boolean, :default => false,
+ :desc => "Generate functional test with HTTP actions only"
+
def create_test_files
- template 'functional_test.rb',
+ template_file = options.http? ? "http_functional_test.rb" : "functional_test.rb"
+
+ template template_file,
File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb")
end