Sha256: 54dd36fb8a4c7309ebf40b5964a107fba0f1a45b7f89da8d3c05b9183acdc252

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

require_relative 'support/spec_helper'

require 'contextual_exceptions/contextual_error'

include ContextualExceptions

SubjectError = Class.new(StandardError)
SubjectError.extend ContextualError

describe ContextualError do
  it '::with_context should work' do
    local_message = 'local message'
    full_context = nil
    begin
      raise
    rescue => full_context
    end
    patient = SubjectError.with_context(local_message, full_context)

    patient.message.must_equal(local_message << ": #{full_context.message}")
    patient.backtrace.must_equal full_context.backtrace
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
contextual_exceptions-0.0.2 spec/contextual_error_spec.rb