File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed 
generators/annotate/templates Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ if Rails.env.development?
5252      'trace'                        =>  'false' , 
5353      'wrapper_open'                 =>  nil , 
5454      'wrapper_close'                =>  nil , 
55-       'with_comment'                 =>  'true' 
55+       'with_comment'                 =>  'true' , 
56+       'with_comment_column'          =>  'false' 
5657    ) 
5758  end 
5859
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ task annotate_models: :environment do
5252  options [ :hide_limit_column_types ]  =  Annotate ::Helpers . fallback ( ENV [ 'hide_limit_column_types' ] ,  '' ) 
5353  options [ :hide_default_column_types ]  =  Annotate ::Helpers . fallback ( ENV [ 'hide_default_column_types' ] ,  '' ) 
5454  options [ :with_comment ]  =  Annotate ::Helpers . true? ( ENV [ 'with_comment' ] ) 
55+   options [ :with_comment_column ]  =  Annotate ::Helpers . true? ( ENV [ 'with_comment_column' ] ) 
5556  options [ :ignore_unknown_models ]  =  Annotate ::Helpers . true? ( ENV . fetch ( 'ignore_unknown_models' ,  'false' ) ) 
5657
5758  AnnotateModels . do_annotations ( options ) 
Original file line number Diff line number Diff line change 1+ require_relative  '../../spec_helper' 
2+ 
3+ describe  'Annotate annotate_models rake task and Annotate.set_defaults'  do  # rubocop:disable RSpec/DescribeClass 
4+   before  do 
5+     Rake . application  =  Rake ::Application . new 
6+     Rake ::Task . define_task ( 'environment' ) 
7+     Rake . load_rakefile ( 'tasks/annotate_models.rake' ) 
8+   end 
9+ 
10+   after  do 
11+     Annotate . instance_variable_set ( '@has_set_defaults' ,  false ) 
12+   end 
13+ 
14+   let ( :annotate_models_argument )  do 
15+     argument  =  nil 
16+     allow ( AnnotateModels ) . to  receive ( :do_annotations )  {  |arg | argument  =  arg  } 
17+     Rake ::Task [ 'annotate_models' ] . invoke 
18+     argument 
19+   end 
20+ 
21+   describe  'with_comment_column'  do 
22+     subject  {  annotate_models_argument [ :with_comment_column ]  } 
23+ 
24+     after  {  ENV . delete ( 'with_comment_column' )  } 
25+ 
26+     context  'when Annotate.set_defaults is not called (defaults)'  do 
27+       it  {  is_expected . to  be_falsey  } 
28+     end 
29+ 
30+     context  'when Annotate.set_defaults sets it to "true"'  do 
31+       before  {  Annotate . set_defaults ( 'with_comment_column'  =>  'true' )  } 
32+ 
33+       it  {  is_expected . to  be_truthy  } 
34+     end 
35+   end 
36+ end 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments