Class: Rails::TestTask::TestCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/sub_test_task_patch.rb

Overview

A utility class which is used primarily in “rails/test_unit/testing.rake” to help define rake tasks corresponding to rake test.

This class takes a TestInfo class and defines the appropriate rake task based on the information, then invokes it.

Instance Method Summary collapse

Constructor Details

#initialize(info) ⇒ TestCreator

:nodoc:



14
15
16
# File 'lib/sub_test_task_patch.rb', line 14

def initialize(info)
  @info = info
end

Instance Method Details

#invoke_rake_taskObject



18
19
20
21
22
23
24
25
# File 'lib/sub_test_task_patch.rb', line 18

def invoke_rake_task
  if @info.files.any?
    create_and_run_single_test
    reset_application_tasks
  else
    Rake::Task[ENV['TEST'] ? 'test:single' : 'test:run'].invoke
  end
end