Sha256: 4b2f9b2acddf7aa0431525c2b166cdba3a59234229e1a371ee6984922e72b07f

Contents?: true

Size: 676 Bytes

Versions: 1

Compression:

Stored size: 676 Bytes

Contents

describe Jerry::Error do
  def raise_error_with_cause
    raise 'Something went wrong'
  rescue RuntimeError
    raise Jerry::Error, 'wrapping error'
  end

  it 'should record the causing exception when there is one' do
    expect { raise_error_with_cause }.to raise_error(Jerry::Error) do |ex|
      expect(ex.cause.message).to eq 'Something went wrong'
    end
  end

  it 'should not record the causing exception when there is none' do
    expect { raise Jerry::Error }.to raise_error(Jerry::Error) do |ex|
      expect(ex.cause).to be_nil
    end
  end

  it 'should have a message' do
    expect { raise Jerry::Error, ':(' }.to raise_error(Jerry::Error, ':(')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jerry-2.0.1 spec/error_spec.rb