Sha256: 3022a90bf8dccb739b86e900c31f36bed7ed19a4bd0d2362f4c731ac1698d904

Contents?: true

Size: 1011 Bytes

Versions: 1

Compression:

Stored size: 1011 Bytes

Contents

begin
  require 'rake/testtask'
rescue LoadError
end

if defined? Rake::TestTask
  namespace :test do
    def look_for_seed(tasks)
      matches = tasks.map { |t| /(seed=.*?)[,\]]/.match(t) }.compact
      if matches.any?
        matches.first[1]
      else
        nil
      end
    end

    tasks = Rake.application.top_level_tasks
    ENV["TESTOPTS"] ||= ""
    if tasks.any? { |t| t.include?("verbose")}
      ENV["TESTOPTS"] += " -v"
    end
    if seed = look_for_seed(tasks)
      ENV["TESTOPTS"] += " --" + seed
    end

    agent_home = File.expand_path(File.join(File.dirname(__FILE__),'..','..'))

    Rake::TestTask.new(:newrelic) do |t|
      
      file_pattern = ENV["file"]
      file_pattern = file_pattern.split(",").map{|f| "#{agent_home}/#{f}".gsub("//", "/")} if file_pattern
      file_pattern ||= "#{agent_home}/test/new_relic/**/*_test.rb"

      t.libs << "#{agent_home}/test"
      t.libs << "#{agent_home}/lib"
      t.pattern = file_pattern
      t.verbose = true
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
newrelic_rpm-6.9.0.363 lib/tasks/tests.rake