@@ -17,6 +17,12 @@ module AnnotateModels
17
17
FIXTURE_TEST_DIR = File . join ( "test" , "fixtures" )
18
18
FIXTURE_SPEC_DIR = File . join ( "spec" , "fixtures" )
19
19
20
+ # Other test files
21
+ CONTROLLER_TEST_DIR = File . join ( "test" , "controllers" )
22
+ CONTROLLER_SPEC_DIR = File . join ( "spec" , "controllers" )
23
+ REQUEST_SPEC_DIR = File . join ( "spec" , "requests" )
24
+ ROUTING_SPEC_DIR = File . join ( "spec" , "routing" )
25
+
20
26
# Object Daddy http://github.com/flogic/object_daddy/tree/master
21
27
EXEMPLARS_TEST_DIR = File . join ( "test" , "exemplars" )
22
28
EXEMPLARS_SPEC_DIR = File . join ( "spec" , "exemplars" )
@@ -52,6 +58,13 @@ module AnnotateModels
52
58
File . join ( FIXTURE_SPEC_DIR , "%PLURALIZED_MODEL_NAME%.yml" ) ,
53
59
]
54
60
61
+ SCAFFOLD_PATTERNS = [
62
+ File . join ( CONTROLLER_TEST_DIR , "%PLURALIZED_MODEL_NAME%_controller_test.rb" ) ,
63
+ File . join ( CONTROLLER_SPEC_DIR , "%PLURALIZED_MODEL_NAME%_controller_spec.rb" ) ,
64
+ File . join ( REQUEST_SPEC_DIR , "%PLURALIZED_MODEL_NAME%_spec.rb" ) ,
65
+ File . join ( ROUTING_SPEC_DIR , "%PLURALIZED_MODEL_NAME%_routing_spec.rb" ) ,
66
+ ]
67
+
55
68
FACTORY_PATTERNS = [
56
69
File . join ( EXEMPLARS_TEST_DIR , "%MODEL_NAME%_exemplar.rb" ) ,
57
70
File . join ( EXEMPLARS_SPEC_DIR , "%MODEL_NAME%_exemplar.rb" ) ,
@@ -344,6 +357,7 @@ def remove_annotation_of_file(file_name)
344
357
# :exclude_fixtures<Symbol>:: whether to skip modification of fixture files
345
358
# :exclude_factories<Symbol>:: whether to skip modification of factory files
346
359
# :exclude_serializers<Symbol>:: whether to skip modification of serializer files
360
+ # :exclude_scaffolds<Symbol>:: whether to skip modification of scaffold files
347
361
#
348
362
def annotate ( klass , file , header , options = { } )
349
363
begin
@@ -357,7 +371,7 @@ def annotate(klass, file, header, options={})
357
371
did_annotate = true
358
372
end
359
373
360
- %w( test fixture factory serializer ) . each do |key |
374
+ %w( test fixture factory serializer scaffold ) . each do |key |
361
375
exclusion_key = "exclude_#{ key . pluralize } " . to_sym
362
376
patterns_constant = "#{ key . upcase } _PATTERNS" . to_sym
363
377
position_key = "position_in_#{ key } " . to_sym
@@ -510,7 +524,7 @@ def remove_annotations(options={})
510
524
model_file_name = file
511
525
deannotated_klass = true if ( remove_annotation_of_file ( model_file_name ) )
512
526
513
- ( TEST_PATTERNS + FIXTURE_PATTERNS + FACTORY_PATTERNS + SERIALIZER_PATTERNS ) .
527
+ ( TEST_PATTERNS + SCAFFOLD_PATTERNS + FIXTURE_PATTERNS + FACTORY_PATTERNS + SERIALIZER_PATTERNS ) .
514
528
map { |file | resolve_filename ( file , model_name , table_name ) } .
515
529
each do |file |
516
530
if File . exist? ( file )
0 commit comments