Sha256: 2562ab05aa07c32c6dfc03e9ce72492c6808c7310ab36f1a9777e7e5b1b1baf1

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 KB

Contents

# coding: utf-8

namespace :test do
  desc 'Run all unit tests'
  task :unit do
    $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/..'))

    files = Dir['test/unit/**/test_*.rb'] + Dir['test/unit/**/*_spec.rb']
    files.each {|f| require f }
  end
  
  namespace :bench do
    Dir['test/benchmark/bench_*.rb'].each do |f|
      benchname = File.basename(f, '.*').sub(/bench_/, '')
      
      desc "Run #{benchname} benchmark"
      task benchname.to_sym do
        require File.expand_path(f)
      end
    end
  end
  
  namespace :case do
    desc 'Run all special test cases [MANAGE_TEMPLATES(false): true/false]'
    task :all do
      $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/..'))
      
      require 'test/case/helper'
      
      Dir['test/case/*/*.rb'].each do |f|
        if ENV['MANAGE_TEMPLATES']
          ThinReports.config.generator.pdf.manage_templates = File.expand_path(File.dirname(f))
        end
        require f
      end
    end
    
    desc 'Reset all output of test cases'
    task :reset do
      File.delete(*Dir['test/case/*/*.pdf'])
    end
    
    Dir['test/case/*/*.rb'].each do |f|
      casename = File.basename(File.dirname(f))
      
      desc "Run #{casename} case [MANAGE_TEMPLATE(false): true/false]"
      task casename.to_sym do
        $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/..'))
        
        require 'test/case/helper'
        
        if ENV['MANAGE_TEMPLATES']
          ThinReports.config.generator.pdf.manage_templates = File.expand_path(File.dirname(f))
        end        
        require "test/case/#{casename}/#{casename}"
      end
    end
  end
  
  desc 'Alias for test:case:all'
  task :case => [:'case:all']
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.7.0 tasks/test.rake