Class: Rails::TestTask::TestCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/test_unit/sub_test_task.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

Returns a new instance of TestCreator.



11
12
13
# File 'lib/rails/test_unit/sub_test_task.rb', line 11

def initialize(info)
  @info = info
end

Instance Method Details

#invoke_rake_taskObject



15
16
17
18
19
20
21
22
# File 'lib/rails/test_unit/sub_test_task.rb', line 15

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