Sha256: b0d3eb428f70cf9274d33ce3f120f37c36ed95aacf3d86ca0a979e86ac5a271f

Contents?: true

Size: 902 Bytes

Versions: 5

Compression:

Stored size: 902 Bytes

Contents

require File.expand_path('spec_helper', File.dirname(__FILE__))

module Ftpd
  describe ExceptionTranslator do

    class FooError < StandardError ; end
    class BarError < StandardError ; end

    subject(:translator) {ExceptionTranslator.new}
    let(:message) {'An error happened'}

    context '(registered exception)' do
      before(:each) do
        translator.register_exception FooError
      end
      it 'should translate the exception' do
        expect {
          subject.translate_exceptions do
            raise FooError, message
          end
        }.to raise_error PermanentFileSystemError, message
      end
    end

    context '(unregistered exception)' do
      it 'should pass the exception' do
        expect {
          subject.translate_exceptions do
            raise BarError, message
          end
        }.to raise_error BarError, message
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
ftpd-1.1.1 spec/exception_translator_spec.rb
ftpd-1.1.0 spec/exception_translator_spec.rb
investtools-ftpd-1.0.1 spec/exception_translator_spec.rb
ftpd-1.0.1 spec/exception_translator_spec.rb
ftpd-1.0.0 spec/exception_translator_spec.rb