diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-01 20:12:29 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-02 10:27:40 +0200 |
commit | 1a4d8aca8a675aa02cead4b1db53ba5a3f9aa326 (patch) | |
tree | 788c5de55db47408ee4e1376ba1cdc11d3923b5c /railties/lib/generators/test_unit | |
parent | 86ff07410145430d08e97a8296486c4cd4304cde (diff) | |
download | rails-1a4d8aca8a675aa02cead4b1db53ba5a3f9aa326.tar.gz rails-1a4d8aca8a675aa02cead4b1db53ba5a3f9aa326.tar.bz2 rails-1a4d8aca8a675aa02cead4b1db53ba5a3f9aa326.zip |
Added tests to scaffold controller.
Diffstat (limited to 'railties/lib/generators/test_unit')
-rw-r--r-- | railties/lib/generators/test_unit/scaffold/scaffold_generator.rb | 2 | ||||
-rw-r--r-- | railties/lib/generators/test_unit/scaffold/templates/functional_test.rb | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb index 7c73a23267..0f6255383e 100644 --- a/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb +++ b/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb @@ -4,6 +4,8 @@ module TestUnit module Generators class ScaffoldGenerator < Base include Rails::Generators::ControllerNamedBase + + class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller" check_class_collision :suffix => "ControllerTest" def create_test_files diff --git a/railties/lib/generators/test_unit/scaffold/templates/functional_test.rb b/railties/lib/generators/test_unit/scaffold/templates/functional_test.rb index cd2fc578bf..e4bf4035da 100644 --- a/railties/lib/generators/test_unit/scaffold/templates/functional_test.rb +++ b/railties/lib/generators/test_unit/scaffold/templates/functional_test.rb @@ -1,11 +1,13 @@ require 'test_helper' class <%= controller_class_name %>ControllerTest < ActionController::TestCase +<% unless options[:singleton] -%> test "should get index" do get :index assert_response :success assert_not_nil assigns(:<%= table_name %>) end +<% end -%> test "should get new" do get :new |