Class: RedminePluginSupport::TestUnitTask

Inherits:
GeneralTask
  • Object
show all
Defined in:
lib/redmine_plugin_support/test_unit_task.rb

Instance Attribute Summary

Attributes inherited from GeneralTask

#name

Instance Method Summary collapse

Methods inherited from GeneralTask

#initialize

Constructor Details

This class inherits a constructor from RedminePluginSupport::GeneralTask

Instance Method Details

#defineObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/redmine_plugin_support/test_unit_task.rb', line 6

def define

  desc 'Run all unit, functional and integration tests'
  task :test do
    errors = %w(test:units test:functionals test:integration).collect do |task|
      begin
        Rake::Task[task].invoke
        nil
      rescue => e
        task
      end
    end.compact
    abort "Errors running #{errors.to_sentence}!" if errors.any?
  end

  namespace :test do
    Rake::TestTask.new(:units => [:environment, 'db:test:prepare']) do |t|
      t.libs << "test"
      t.pattern = 'test/unit/**/*_test.rb'
      t.verbose = true
    end
    Rake::Task['test:units'].comment = "Run the unit tests in test/unit"

    Rake::TestTask.new(:functionals => [:environment, 'db:test:prepare']) do |t|
      t.libs << "test"
      t.pattern = 'test/functional/**/*_test.rb'
      t.verbose = true
    end
    Rake::Task['test:functionals'].comment = "Run the functional tests in test/functional"

    Rake::TestTask.new(:integration => [:environment, 'db:test:prepare']) do |t|
      t.libs << "test"
      t.pattern = 'test/integration/**/*_test.rb'
      t.verbose = true
    end
    Rake::Task['test:integration'].comment = "Run the integration tests in test/integration"

    Rake::TestTask.new(:benchmark => [:environment, 'db:test:prepare']) do |t|
      t.libs << 'test'
      t.pattern = 'test/performance/**/*_test.rb'
      t.verbose = true
      t.options = '-- --benchmark'
    end
    Rake::Task['test:benchmark'].comment = 'Benchmark the performance tests'

    Rake::TestTask.new(:profile => [:environment, 'db:test:prepare']) do |t|
      t.libs << 'test'
      t.pattern = 'test/performance/**/*_test.rb'
      t.verbose = true
    end
    Rake::Task['test:profile'].comment = 'Profile the performance tests'
  end
  
  self
end