Sha256: 5c08edd9142c85853a086f0a1aab24ead23196c4e2ea09788a8b0dd20242eaf0
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
require 'test_helper' require 'error_stalker/backend/in_memory' class ClientTest < Test::Unit::TestCase def setup super @backend = ErrorStalker::Backend::InMemory.new ErrorStalker::Client.backend = @backend end def test_report ErrorStalker::Client.report(:unit_test, new_exception, {:name => "Bob"}) assert_equal 1, @backend.exceptions.length exception_report = @backend.exceptions.first assert_equal :unit_test, exception_report.application assert_equal exception_report.send(:machine_name), exception_report.machine assert_match "test/unit/client_test.rb:", exception_report.backtrace.first assert_equal 'Bob', exception_report.data[:name] assert_equal 'NoMethodError', exception_report.type end def test_report_exceptions_in_block assert_raises NoMethodError do ErrorStalker::Client.report_exceptions(:unit_test) do raise new_exception end assert_equal 1, @backend.exceptions.length end end def test_report_exceptions_in_block_without_reraise assert_nothing_raised do ErrorStalker::Client.report_exceptions(:unit_test, :reraise => false) do raise new_exception end assert_equal 1, @backend.exceptions.length ErrorStalker::Client.report_exceptions(:unit_test, :reraise => nil) do raise new_exception end assert_equal 2, @backend.exceptions.length end end def test_dont_raise_exceptions_during_report ErrorStalker::Client.backend = nil assert_nothing_raised do ErrorStalker::Client.report(:unit_test, new_exception, {:name => "Bob"}) end end def new_exception exception = nil begin nil.foo rescue => e exception = e end exception end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
error_stalker-0.0.13 | test/unit/client_test.rb |
error_stalker-0.0.12 | test/unit/client_test.rb |