Sha256: 0d3f05318f1b5ef07533b9b6701f7a4e81ee2be1d440611be8fd46a773cb1576

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'

class ExceptionReportTest < Test::Unit::TestCase

  def test_serialization
    original_report = ErrorStalker::ExceptionReport.new(:application => :unit_test, :exception => NoMethodError.new, :data => {:name => "Bob"})

    exception_report = ErrorStalker::ExceptionReport.new(JSON.parse(original_report.to_json))
    
    assert_equal 'unit_test', exception_report.application
    assert_equal exception_report.send(:machine_name), exception_report.machine
    assert_equal 'Bob', exception_report.data['name']
    assert_equal 'NoMethodError', exception_report.type
  end

  def test_digest
    report = ErrorStalker::ExceptionReport.new(:application => :unit_test, :exception => "Bob", :data => {:name => "Bob"})
    report2 = ErrorStalker::ExceptionReport.new(:application => :unit_test, :exception => "Bob", :data => {:name => "Bob"})
    report3 = ErrorStalker::ExceptionReport.new(:application => :unit_test, :exception => "Fred", :data => {:name => "Bob"})

    assert_equal report.digest, report2.digest
    assert_not_equal report.digest, report3.digest
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
error_stalker-0.0.16 test/unit/exception_report_test.rb
error_stalker-0.0.15 test/unit/exception_report_test.rb
error_stalker-0.0.14 test/unit/exception_report_test.rb
error_stalker-0.0.13 test/unit/exception_report_test.rb
error_stalker-0.0.12 test/unit/exception_report_test.rb