Class: Corundum::RSpecTask

Inherits:
Mattock::Rake::CommandTask
  • Object
show all
Defined in:
lib/corundum/rspec-task.rb

Direct Known Subclasses

RSpecReportTask

Instance Method Summary collapse

Instance Method Details

#all_rspec_optionsObject



37
38
39
# File 'lib/corundum/rspec-task.rb', line 37

def all_rspec_options
  rspec_opts
end

#default_configuration(rspec) ⇒ Object



16
17
18
19
# File 'lib/corundum/rspec-task.rb', line 16

def default_configuration(rspec)
  super
  rspec.copy_settings_to(self)
end

#resolve_configurationObject



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/corundum/rspec-task.rb', line 41

def resolve_configuration
  super

  if task_args.last.is_a? Hash
    key = task_args.last.keys.first
    task_args.last[key] = [*task_args.last[key]] + file_dependencies
  else
    key = task_args.pop
    task_args << { key => file_dependencies }
  end
end

#resolve_runtime_configurationObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/corundum/rspec-task.rb', line 21

def resolve_runtime_configuration
  self.rspec_path = %x"which #{rspec_path}".chomp

  ruby_command.options << ruby_opts if ruby_opts
  ruby_command.options << "-w" if warning

  self.runner_command = cmd(rspec_path) do |cmd|
    cmd.options << all_rspec_options
    cmd.options << files_to_run
  end

  self.command = ruby_command - runner_command

  super
end