Sha256: 5c0b660508a890cf162dc0024e23430fc31103c1d1f67c9c60d4ca170ae588ab

Contents?: true

Size: 861 Bytes

Versions: 19

Compression:

Stored size: 861 Bytes

Contents

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

module Ftpd
  describe ExceptionTranslator do

    class FooError < 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

19 entries across 19 versions & 1 rubygems

Version Path
ftpd-0.17.0 spec/exception_translator_spec.rb
ftpd-0.16.0 spec/exception_translator_spec.rb
ftpd-0.15.0 spec/exception_translator_spec.rb
ftpd-0.14.0 spec/exception_translator_spec.rb
ftpd-0.13.0 spec/exception_translator_spec.rb
ftpd-0.12.0 spec/exception_translator_spec.rb
ftpd-0.11.0 spec/exception_translator_spec.rb
ftpd-0.10.0 spec/exception_translator_spec.rb
ftpd-0.9.0 spec/exception_translator_spec.rb
ftpd-0.7.1 spec/exception_translator_spec.rb
ftpd-0.8.0 spec/exception_translator_spec.rb
ftpd-0.7.0 spec/exception_translator_spec.rb
ftpd-0.6.0 spec/exception_translator_spec.rb
ftpd-0.5.0 spec/exception_translator_spec.rb
ftpd-0.4.0 spec/exception_translator_spec.rb
ftpd-0.3.2 spec/exception_translator_spec.rb
ftpd-0.3.1 spec/exception_translator_spec.rb
ftpd-0.2.2 spec/exception_translator_spec.rb
ftpd-0.2.1 spec/exception_translator_spec.rb