Permalink
Browse files

Added option to skip controller tests

Signed-off-by: Jonas Grimfelt <grimen@gmail.com>
  • Loading branch information...
1 parent f9c6637 commit 7dcf27cd5d74610016bbb40effccb7fa526ac87f @pelle pelle committed with Sep 23, 2009
Showing with 13 additions and 2 deletions.
  1. +2 −1 README.textile
  2. +1 −0 config/scaffold.yml
  3. +9 −1 generators/dry_scaffold/dry_scaffold_generator.rb
  4. +1 −0 lib/dry_generator.rb
View
@@ -244,7 +244,7 @@ Don't ask me why me why this is the only way with gems...Ask the Rails core team
h2. Usage
-<pre>./script/generate dry_scaffold ModelName [attribute:type attribute:type] [_actions:new,create,...] [_formats:html,json,...] [_indexes:attribute,...] [--skip-pagination] [--skip-resourceful] [--skip-formtastic] [--skip-views] [--skip-helpers] [--skip-migration] [--skip-timestamps] [--skip-tests] [--layout] [--tunit] [--shoulda] [--rspec] [--fixtures] [--fgirl] [--machinist] [--odaddy]</pre>
+<pre>./script/generate dry_scaffold ModelName [attribute:type attribute:type] [_actions:new,create,...] [_formats:html,json,...] [_indexes:attribute,...] [--skip-pagination] [--skip-resourceful] [--skip-formtastic] [--skip-views] [--skip-helpers] [--skip-migration] [--skip-timestamps] [--skip-tests] [--skip-controller-tests] [--layout] [--tunit] [--shoulda] [--rspec] [--fixtures] [--fgirl] [--machinist] [--odaddy]</pre>
...or use the alias @dscaffold@ instead of @dry_scaffold@.
@@ -401,6 +401,7 @@ These are the options for the scaffold-generator.
* @--skip-views@ - Don't generate views.
* @--skip-helpers@ - Don't generate helpers.
* @--skip-builders@ - Don't generate builders.
+* @--skip-controller-tests@ - Don't generate controller tests
* @--layout@ - Generate layout.
h4. Model
View
@@ -11,6 +11,7 @@ dry_scaffold:
views: true
helpers: true
tests: true
+ controller_tests: true
test_unit: true
shoulda: false
rspec: false
@@ -141,7 +141,7 @@ def manifest
File.join(CONTROLLERS_PATH, controller_class_path, "#{controller_file_name}_controller.rb")
# Controller Tests.
- unless options[:skip_tests]
+ unless options[:skip_tests] || options[:skip_controller_tests]
controller_tests_path = File.join(TEST_PATHS[test_framework], FUNCTIONAL_TESTS_PATH[test_framework])
m.directory File.join(controller_tests_path, controller_class_path)
m.template File.join('controllers', 'tests', "#{test_framework}", 'functional_test.rb'),
@@ -350,6 +350,10 @@ def add_options!(opt)
options[:formtastic] = !v
end
+ opt.on("--skip-controller-tests", "Controller: Skip generation of tests for controller.") do |v|
+ options[:skip_controller_tests] = v
+ end
+
opt.on('--skip-views', "View: Skip generation of views.") do |v|
options[:skip_views] = v
end
@@ -383,6 +387,10 @@ def add_options!(opt)
options[:skip_tests] = v
end
+ opt.on("--skip-controller tests", "Controller: Skip generation of tests for controller.") do |v|
+ options[:skip_controller_tests] = v
+ end
+
opt.separator ' '
end
@@ -40,6 +40,7 @@ class DryGenerator < Rails::Generator::NamedBase
:formtastic => CONFIG_OPTIONS['formtastic'] || HAS_FORMTASTIC,
:pagination => CONFIG_OPTIONS['pagination'] || HAS_WILL_PAGINATE,
:skip_tests => !CONFIG_OPTIONS['tests'] || false,
+ :skip_controller_tests => !CONFIG_OPTIONS['controller_tests'] || false,
:skip_helpers => !CONFIG_OPTIONS['helpers'] || false,
:skip_views => !CONFIG_OPTIONS['views'] || false,
:layout => CONFIG_OPTIONS['layout'] || false,

0 comments on commit 7dcf27c

Please sign in to comment.