Permalink
Browse files

Bootstrap test suite + very simple test.

  • Loading branch information...
1 parent 8e64659 commit 6e20aced89e68df8a68340972c772e2595d90c06 @spectator spectator committed Mar 15, 2013
Showing with 37 additions and 0 deletions.
  1. +11 −0 Rakefile
  2. +26 −0 test/newrelic_rake_test.rb
View
11 Rakefile
@@ -1 +1,12 @@
require "bundler/gem_tasks"
+require 'rake/testtask'
+
+desc 'Default: run unit tests'
+task :default => :test
+
+desc 'Test newrelic-rake'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'test'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
View
26 test/newrelic_rake_test.rb
@@ -0,0 +1,26 @@
+require 'test/unit'
+require 'newrelic-rake/instrument'
+
+class TestNewRelicRedis < Test::Unit::TestCase
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation
+
+ def setup
+ NewRelic::Agent.manual_start
+ @engine = NewRelic::Agent.instance.stats_engine
+ @engine.clear_stats
+
+ @sampler = NewRelic::Agent.instance.transaction_sampler
+ @sampler.reset!
+ @sampler.start_builder
+ end
+
+ def teardown
+ @sampler.clear_builder
+ end
+
+ def test_metrics
+ Rake::Task.define_task('foo')
+ Rake::Task['foo'].invoke
+ assert @engine.metrics.include?('OtherTransaction/Rake/Rake::Task/foo'), 'rake task is not in metrics'
+ end
+end

0 comments on commit 6e20ace

Please sign in to comment.