class Piggly::TestTask

Attributes

accumulate[RW]
report_root[RW]
test_files[RW]

Public Class Methods

new(name = :piggly) click to toggle source
Calls superclass method Piggly::AbstractTask::new
# File lib/piggly/task.rb, line 170
def initialize(name = :piggly)
  @report_root = nil
  @test_files  = []
  @accumulate  = false
  super(name)
end

Private Instance Methods

define() click to toggle source
# File lib/piggly/task.rb, line 179
def define
  desc 'Run piggly tests' + (@name == :piggly ? '' : " for #{@name}")
  task @name do
    RakeFileUtils.verbose(@verbose) do
      opts  = @ruby_opts.clone
      opts << (@piggly_path ? quote(@piggly_path) : "-S piggly")
      opts << "test"
      opts << "--accumulate" if @accumulate
      opts << "--cache-root #{quote @cache_root}" if @cache_root
      opts << "--report-root #{quote @report_root}" if @report_root

      case @procedures
      when String then opts << "--name #{quote @procedures}"
      when Regexp then opts << "--name #{quote @procedures.inspect}"
      when Array
        @procedures.each do |p|
          case p
          when String then opts << "--name #{quote p}"
          when Regexp then opts << "--name #{quote p.inspect}"
          end
        end
      end

      opts.concat(@piggly_opts)

      unless (@test_files || []).empty?
        opts << "--"
        opts.concat(@test_files.map{|x| quote(x) })
      end

      ruby(opts.join(" "))
    end
  end
end