Class: Henry::Task::RspecTask

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

Overview

The Henry Task implementation for Rspec

Constant Summary collapse

OUT_PATH =

The temporary output file path for the RspecTask execution.

'rspec.out'
DEFAULT_OUTPUT_BASE_DIR =

Default base output directory

'.output'
REPORTS_DIR =

The reports path template.

'reports/${FORMAT}'
TIME_FORMAT =

Default time format to be used in the reports filepath.

'%Y-%m-%dT%H%M%S'
APPLICATION_NAME =

The Rspec Rake Application name.

Returns:

  • (String)

    the rake application name.

'spec'

Instance Attribute Summary collapse

Attributes inherited from Henry::Task

#data, #enabled, #name, #timeout

Instance Method Summary collapse

Methods inherited from RakeTask

#execute

Methods inherited from Henry::Task

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

Constructor Details

This class inherits a constructor from Henry::Task

Instance Attribute Details

#generated_reportsObject

Returns the value of attribute generated_reports.



11
12
13
# File 'lib/henry/task/rspec_task.rb', line 11

def generated_reports
  @generated_reports
end

#report_recipientsObject

Returns the value of attribute report_recipients.



11
12
13
# File 'lib/henry/task/rspec_task.rb', line 11

def report_recipients
  @report_recipients
end

Instance Method Details

#after_executeObject



38
39
40
# File 'lib/henry/task/rspec_task.rb', line 38

def after_execute
  super
end

#application_nameObject



30
31
32
# File 'lib/henry/task/rspec_task.rb', line 30

def application_name
  APPLICATION_NAME
end

#base_output_pathString

Returns output base path

Returns:

  • (String)

    the base output path.



45
46
47
# File 'lib/henry/task/rspec_task.rb', line 45

def base_output_path
  @base_output_path ||= (self.data.system[:output_directory] ? "#{self.data.system[:output_directory]}/output" : DEFAULT_OUTPUT_BASE_PATH)
end

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

Configures the Task.

Parameters:

  • params (Hash)

    the task params.

  • extended_context (Hash) (defaults to: {})

    the task extended context.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/henry/task/rspec_task.rb', line 53

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

  # Makes available the spec rake task.
  Rake.application.clear
  RSpec::Core::RakeTask.new do |t|
    if self.data.options
      t.pattern = self.data.options['pattern'] || 'spec/*'
      t.rspec_opts = "#{self.custom_options(extended_context['options']||{})}"
    else
      t.pattern = 'spec/*'
      t.rspec_opts = "#{self.default_options} #{extended_context['options']}"
    end
  end

  super
end

#out_pathObject



34
35
36
# File 'lib/henry/task/rspec_task.rb', line 34

def out_path
  OUT_PATH
end