Sha256: f663971bb5ba8fb6839de466b6bcae6938ce30a9e752a85784d4482e6954854e
Contents?: true
Size: 1.55 KB
Versions: 1
Compression:
Stored size: 1.55 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') class TartarusRescueTestController < ApplicationController end describe Tartarus::Rescue do before(:each) do @controller = TartarusRescueTestController.new end describe 'when mixed into another class' do it 'should alias_method_chain rescue_action method with tartarus' do @controller.should respond_to(:rescue_action_with_tartarus) @controller.should respond_to(:rescue_action_without_tartarus) end end describe "#rescue_action_with_tartarus" do before(:each) do @exception = StandardError.new @controller.stub!(:rescue_action_without_tartarus) @controller.stub!(:response_code_for_rescue).and_return(:internal_server_error) Tartarus.stub!(:log) end it 'should log the exception with tartarus if the exception code should be an internal server error' do Tartarus.should_receive(:log).with(@controller, @exception) @controller.should_receive(:response_code_for_rescue).and_return(:internal_server_error) @controller.rescue_action_with_tartarus(@exception) end it 'should not log the exception with tartarus if the exception code is not an internal server error' do @controller.should_receive(:response_code_for_rescue).and_return(:not_found) @controller.rescue_action_with_tartarus(@exception) end it 'should invoke rescue_action_without_tartarus' do @controller.should_receive(:rescue_action_without_tartarus) @controller.rescue_action_with_tartarus(@exception) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tartarus-1.0.0 | spec/tartarus/rescue_spec.rb |