Class: Hydra::TestTask

Inherits:
Task
  • Object
show all
Defined in:
lib/hydra/tasks.rb

Overview

Define a test task that uses hydra to test the files.

Hydra::TestTask.new('hydra') do |t|
  t.add_files 'test/unit/**/*_test.rb'
  t.add_files 'test/functional/**/*_test.rb'
  t.add_files 'test/integration/**/*_test.rb'
  t.verbose = false # optionally set to true for lots of debug messages
  t.autosort = false # disable automatic sorting based on runtime of tests
end

Instance Attribute Summary

Attributes inherited from Task

#autosort, #config, #files, #listeners, #name, #verbose

Instance Method Summary collapse

Methods inherited from Task

#add_files, #find_config_file

Constructor Details

#initialize(name = :hydra) {|_self| ... } ⇒ TestTask

Create a new HydraTestTask

Yields:

  • (_self)

Yield Parameters:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/hydra/tasks.rb', line 66

def initialize(name = :hydra)
  @name = name
  @files = []
  @verbose = false
  @autosort = true
  @listeners = [Hydra::Listener::ProgressBar.new]

  yield self if block_given?

  @config = find_config_file

  @opts = {
    :verbose => @verbose,
    :autosort => @autosort,
    :files => @files,
    :listeners => @listeners
  }
  if @config
    @opts.merge!(:config => @config)
  else
    @opts.merge!(:workers => [{:type => :local, :runners => 1}])
  end

  define
end