Sha256: fefa3f744cd0900fd5cdd9cea1fdeb418588755d0c51187e98eed142a8b106d7

Contents?: true

Size: 1.67 KB

Versions: 16

Compression:

Stored size: 1.67 KB

Contents

require File.dirname(__FILE__) << "/test_helper"

class Gizmo
  
  def oops!
    raise 'I made an oopsie!'
  end
    
end

class ReliabilityTest < Test::Unit::TestCase
  
  context "FiveRuns Dash" do
    
    should 'not swallow user-created exceptions' do
      dash do |metrics|
        metrics.time(:oops, 'Time spent messing up', 'Ooops!', 
                     :method => 'Gizmo#oops!')
      end
      
      assert_raises(RuntimeError) { Gizmo.new.oops! }
    end
    
    should 'report an exception if instrumentation cannot proceed' do
      assert_raises(Fiveruns::Dash::Instrument::Error) do
        dash do |metrics|
          metrics.time(:wheee, 'Time spent having fun', 'Wheeee!',
                       :method => 'Gizmo.wheeeeeeee!')
          metrics.time(:oops, 'Time spent messing up', 'Ooops!', 
                       :method => 'Gizmo#oops!')
        end
      end
    end
    
    should 'not proceed with instrumentation if an error occurs' do
      begin
        dash do |metrics|
          metrics.time(:wheee, 'Time spent having fun', 'Wheeee!',
                       :method => 'Gizmo.wheeeeeeee!')
          metrics.time(:oops, 'Time spent messing up', 'Ooops!', 
                       :method => 'Gizmo#oops!')
        end
      rescue Fiveruns::Dash::Instrument::Error
      end
      assert_equal 0, Fiveruns::Dash.configuration.metrics.length
    end
    
    should 'not modify Thread.abort_on_exception if the user has set it' do
      assert !Thread.abort_on_exception
    end
    
  end
  
  def dash(&block)
    Fiveruns::Dash.configure({:app => ENV['DASH_APP']}, &block)
    Fiveruns::Dash.session.reporter.interval = 10
    Fiveruns::Dash.session.start
  end
  
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fiveruns-dash-ruby-0.7.0 test/reliability_test.rb
fiveruns-dash-ruby-0.7.1 test/reliability_test.rb
fiveruns-dash-ruby-0.7.2 test/reliability_test.rb
fiveruns-dash-ruby-0.7.3 test/reliability_test.rb
fiveruns-dash-ruby-0.7.4 test/reliability_test.rb
fiveruns-dash-ruby-0.7.5 test/reliability_test.rb
fiveruns-dash-ruby-0.7.6 test/reliability_test.rb
fiveruns-dash-ruby-0.8.0 test/reliability_test.rb
fiveruns-dash-ruby-0.8.1 test/reliability_test.rb
fiveruns-dash-ruby-0.8.10 test/reliability_test.rb
fiveruns-dash-ruby-0.8.3 test/reliability_test.rb
fiveruns-dash-ruby-0.8.4 test/reliability_test.rb
fiveruns-dash-ruby-0.8.5 test/reliability_test.rb
fiveruns-dash-ruby-0.8.6 test/reliability_test.rb
fiveruns-dash-ruby-0.8.8 test/reliability_test.rb
fiveruns-dash-ruby-0.8.9 test/reliability_test.rb