Sha256: 2e7085864353a69141a34541b8f432e9035a805d2acf5b52c90316ed876f1957

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

module DeepTest
  class TestTask
    attr_accessor :libs, :requires

    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
    
    def define
      require 'rake'
      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

    Options::VALID_OPTIONS.each do |option|
      eval <<-end_src
        def #{option.name}
          @options.#{option.name}
        end

        def #{option.name}=(value)
          @options.#{option.name} = value
        end
      end_src
    end

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

  private

    def runner
      File.expand_path(File.dirname(__FILE__) + "/../../script/internal/run_test_suite.rb")
    end    
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
jperkins-deep_test-1.2.2 lib/deep_test/test_task.rb
jstorimer-deep-test-1.4.0 lib/deep_test/test_task.rb
jstorimer-deep-test-1.3.0 lib/deep_test/test_task.rb
jstorimer-deep-test-1.2.0 lib/deep_test/test_task.rb
jstorimer-deep-test-1.1.0 lib/deep_test/test_task.rb
jstorimer-deep-test-1.0.0 lib/deep_test/test_task.rb