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, #environment, #files, #listeners, #name, #options, #runner_log_file, #serial, #show_time, #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:



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/hydra/tasks.rb', line 85

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

  yield self if block_given?

  # Ensure we override rspec's at_exit
  if defined?(RSpec)
    RSpec::Core::Runner.disable_autorun!
  end

  unless @serial
    @config = find_config_file
  end

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

  define
end