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, #serial, #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:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/hydra/tasks.rb', line 71

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

  yield self if block_given?

  # Ensure we override rspec's at_exit
  require 'hydra/spec/autorun_override'

  unless @serial
    @config = find_config_file
  end

  @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