Class: Assert::RakeTasks::TestTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/assert/rake_tasks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :test) {|_self| ... } ⇒ TestTask

Create a testing task.

Yields:

  • (_self)

Yield Parameters:



29
30
31
32
33
34
# File 'lib/assert/rake_tasks.rb', line 29

def initialize(name=:test)
  @name = name
  @description = "Run tests" + (@name==:test ? "" : " for #{@name}")
  @test_files = []
  yield self if block_given?
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



26
27
28
# File 'lib/assert/rake_tasks.rb', line 26

def description
  @description
end

#nameObject

Returns the value of attribute name.



26
27
28
# File 'lib/assert/rake_tasks.rb', line 26

def name
  @name
end

#test_filesObject

Returns the value of attribute test_files.



26
27
28
# File 'lib/assert/rake_tasks.rb', line 26

def test_files
  @test_files
end

Instance Method Details

#file_listObject

:nodoc:



44
45
46
# File 'lib/assert/rake_tasks.rb', line 44

def file_list # :nodoc:
  @test_files.collect{|f| "\"#{f}\""}.join(' ')
end

#to_taskObject

Define the rake task to run this test suite



37
38
39
40
41
42
# File 'lib/assert/rake_tasks.rb', line 37

def to_task
  desc @description
  task @name do
    RakeFileUtils.verbose(true) { ruby "\"#{rake_loader}\" " + file_list }
  end
end