Sha256: 343a1d3342939369ac436c837398c6fadb2bb34437d2f81a45b4995dd2cac4b4

Contents?: true

Size: 836 Bytes

Versions: 23

Compression:

Stored size: 836 Bytes

Contents

begin
  require 'rake/testtask'
rescue LoadError => e
end

if defined? Rake::TestTask
  namespace :test do |t|
    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|
      t.libs << "#{agent_home}/test"
      t.libs << "#{agent_home}/lib"
      t.pattern = "#{agent_home}/test/new_relic/**/*_test.rb"
      t.verbose = true
    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
newrelic_rpm-3.9.2.239 lib/tasks/tests.rake
newrelic_rpm-3.9.1.236 lib/tasks/tests.rake
newrelic_rpm-3.9.0.229 lib/tasks/tests.rake