Class: WTT::RSpec::MapTask

Inherits:
RSpec::Core::RakeTask
  • Object
show all
Defined in:
lib/wtt/rspec/map_task.rb

Overview

Task that runs all specs and produces a map.

Constant Summary collapse

MAP_FORMATTER =
'--require wtt/rspec/formatter --format WTT::RSpec::Formatter --format progress'.freeze

Instance Method Summary collapse

Instance Method Details

#format_opts(formatter) ⇒ Object



14
15
16
# File 'lib/wtt/rspec/map_task.rb', line 14

def format_opts(formatter)
  "#{formatter} #{rspec_opts} --no-fail-fast"
end

#map_commandObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/wtt/rspec/map_task.rb', line 18

def map_command
  cmd_parts = []
  cmd_parts << RUBY
  cmd_parts << ruby_opts
  cmd_parts << rspec_load_path
  cmd_parts << escape(rspec_path)
  cmd_parts << file_exclusion_specification
  cmd_parts << file_inclusion_specification
  cmd_parts << format_opts( MAP_FORMATTER )
  cmd_parts.flatten.reject(&blank).join(" ")
end

#run_task(verbose) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/wtt/rspec/map_task.rb', line 30

def run_task(verbose)
  WTT.with_active_env do
    @repo = Rugged::Repository.discover(Dir.pwd)
    @storage = WTT::Core::Storage.new @repo

    puts 'Mapping RSpec tests...'

    command = "#{map_command}"
    puts command if verbose
    system(command)
  end
end