Class: Henry::Task::MiniTestTask

Inherits:
RakeTask show all
Defined in:
lib/henry/task/minitest_task.rb

Overview

The Henry Task implementation for MiniTest

Constant Summary collapse

OUT_PATH =

The temporary output file path for the MiniTest execution.

'minitest.out'
REPORTS_DIR =

The reports path template.

'.henry/reports/minitest'
APPLICATION_NAME =

The Minitest Rake Application name.

Returns:

  • (String)

    the rake application name.

'minitest'

Instance Attribute Summary

Attributes inherited from Henry::Task

#data, #enabled, #name

Instance Method Summary collapse

Methods inherited from RakeTask

#execute

Methods inherited from Henry::Task

#after_execute, #before_execute, create, #disable!, #disabled?, #enable!, #enabled?, #execute, #execution, #export_params, #initialize, #logger, #report

Constructor Details

This class inherits a constructor from Henry::Task

Instance Method Details

#application_nameObject



21
22
23
# File 'lib/henry/task/minitest_task.rb', line 21

def application_name
  APPLICATION_NAME
end

#configure(params, extended_context = {}) ⇒ Object

Configures the Task.

Parameters:

  • params (Hash)

    the task params.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/henry/task/minitest_task.rb', line 32

def configure(params, extended_context={})
  File.open(OUT_PATH, 'w') { |f| }

  pattern = params['pattern'] || './spec{,/*/**}/*_spec.rb'
  format  = params['format']  || 'SpecReporter'

  File.open("preconfig.rb", 'w') do |f|
    f.write <<CODE
$stdout = File.open('#{OUT_PATH}', 'w')
require 'minitest/autorun'
require 'minitest/reporters'
MiniTest::Reporters.use! MiniTest::Reporters::#{format}.new
CODE
  end

  # Makes available the spec rake task.
  Rake::TestTask.new('minitest') do |t|
    t.pattern = pattern
    t.ruby_opts << "-r ./preconfig"
  end

  self.export_params(params)
end

#out_pathObject



25
26
27
# File 'lib/henry/task/minitest_task.rb', line 25

def out_path
  OUT_PATH
end