tasks/rspec.rake in nkryptic-sandbox-0.2.3 vs tasks/rspec.rake in nkryptic-sandbox-0.2.4

- old
+ new

@@ -7,17 +7,28 @@ t.spec_opts = [ '--options', "spec/spec.opts" ] t.spec_files = FileList[ 'spec/**/*_spec.rb' ] end namespace :spec do - desc "Run all specs in spec directory with RCov" - Spec::Rake::SpecTask.new( :rcov ) do |t| - t.spec_opts = [ '--options', "spec/spec.opts" ] - t.spec_files = FileList[ 'spec/**/*_spec.rb' ] - t.rcov = true - # t.rcov_opts = [ '--exclude', "spec/*" ] - t.rcov_opts = [ '--exclude', "spec" ] + begin + require 'rcov' + + desc "Run all specs in spec directory with RCov" + Spec::Rake::SpecTask.new( :rcov ) do |t| + t.spec_opts = [ '--options', "spec/spec.opts" ] + t.spec_files = FileList[ 'spec/**/*_spec.rb' ] + t.rcov = true + # t.rcov_opts = [ '--exclude', "spec/*" ] + t.rcov_opts = [ '--exclude', "spec" ] + end + + rescue LoadError + puts <<-EOS + To use rcov for testing you must install rcov gem: + gem install rcov + + EOS end desc "Print Specdoc for all specs in spec directory" Spec::Rake::SpecTask.new( :doc ) do |t| t.spec_opts = [ "--format", "specdoc", "--dry-run" ] @@ -38,9 +49,10 @@ end end rescue LoadError puts <<-EOS -To use rspec for testing you must install rspec gem: + To use rspec for testing you must install rspec gem: gem install rspec + EOS end