Class: DeepTest::TestTask

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of TestTask.

Yields:

  • (_self)

Yield Parameters:



5
6
7
8
9
10
11
12
13
# File 'lib/deep_test/test_task.rb', line 5

def initialize(name = :deep_test)
  @requires = []
  @name = name
  @libs = ["lib"]
  @options = Options.new({})
  self.pattern = "test/**/*_test.rb"
  yield self if block_given?
  define
end

Instance Attribute Details

#libsObject

Returns the value of attribute libs.



3
4
5
# File 'lib/deep_test/test_task.rb', line 3

def libs
  @libs
end

#requiresObject

Returns the value of attribute requires.



3
4
5
# File 'lib/deep_test/test_task.rb', line 3

def requires
  @requires
end

Instance Method Details

#defineObject



15
16
17
18
19
20
21
22
# File 'lib/deep_test/test_task.rb', line 15

def define
  desc "Run '#{@name}' suite using DeepTest"
  task @name do
    lib_options = @libs.any? ? "-I" + @libs.join(File::PATH_SEPARATOR) : ""
    require_options = requires.map {|f| "-r#{f}"}.join(" ")
    ruby "#{lib_options} #{require_options} #{runner} '#{@options.to_command_line}'"
  end
end

#pattern=(pattern) ⇒ Object



36
37
38
# File 'lib/deep_test/test_task.rb', line 36

def pattern=(pattern)
  @options.pattern = Dir.pwd + "/" + pattern
end