Sha256: b6bbb2bebb93a61f49bdc352908155e7d3e91a8425a60076c6424691ff5be9d4

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

require 'hoptoad_notifier'

shared_examples_for 'a hoptoad handler' do
  it 'uses the api' do
    HoptoadNotifier.should_receive(:notify).with(exception)
    described_class.handle(exception)
  end
end 

module Sunspot
  module Rails
    module Failover
      describe ExceptionHandlerAdapter do
        describe '.handle' do
          let(:exception) { Exception.new }
    
          context 'with exception_handler not set (default)' do
            it_should_behave_like 'a hoptoad handler'
          end
    
          context 'with exception_handler set to :hoptoad' do
            before { Failover.exception_handler = :hoptoad }
            it_should_behave_like 'a hoptoad handler'
          end
  
          context 'with exception_handler set to a custom class' do
            before { Failover.exception_handler = MyExceptionHandler }
      
            it 'passes the exception to #handle' do
              MyExceptionHandler.should_receive(:handle).with(exception)
              described_class.handle(exception)
            end
          end
          
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sunspot-rails-failover-0.0.5 spec/sunspot/rails/failover/exception_handler_adapter_spec.rb