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'
REPORTS_DIR =

The reports path template.

'.henry/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

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



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

def application_name
  APPLICATION_NAME
end

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

Configures the Task.

Parameters:

  • params (Hash)

    the task params.

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

    the task extended context.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/henry/task/rspec_task.rb', line 37

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

  self.export_params(params)
end

#out_pathObject



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

def out_path
  OUT_PATH
end