Changeset 717

Show
Ignore:
Timestamp:
10/05/07 07:12:21 (1 year ago)
Author:
has.s..@gmail.com
Message:

[Plugin][merb_sequel] added a hack to stop errors raised if :rspec or :test_unit generator has not been set.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/merb_sequel/merb_generators/sequel_model/sequel_model_generator.rb

    r716 r717  
    3636      end 
    3737       
    38       unless options[:skip_testing] 
    39         m.dependency "sequel_model_test", [@name] 
     38      # Check to see if a scope has been set for which test framework to use. 
     39      # If we try to run the dependency without an :rspec or :test_unit scope an 
     40      # error will be raised. 
     41      scopes =RubiGen::Base.sources.map{|a| a.filters if a.respond_to?(:filters)}.compact.uniq.flatten 
     42      if scopes.include?(:rspec) || scopes.include?(:test_unit) 
     43        unless options[:skip_testing]  
     44          m.dependency "sequel_model_test", [@name] 
     45        end 
     46      else 
     47        puts "\nSelect a scope for :rspec or :test_unit in script/generate if you want to generate test stubs\n\n" 
    4048      end 
    41        
    42        
    43     end 
     49 
     50    end     
    4451  end 
    4552