spec/tartarus/rescue_spec.rb in tartarus-1.0.0 vs spec/tartarus/rescue_spec.rb in tartarus-1.0.1

- old
+ new

@@ -18,10 +18,11 @@ 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!(:logging_enabled?).and_return(true) 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) @@ -29,9 +30,21 @@ @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 log the exception with tartarus if exception logging is enabled' do + Tartarus.should_receive(:logging_enabled?).and_return(true) + @controller.rescue_action_with_tartarus(@exception) + end + + it 'should not log the exception with tartarus if exception logging is disabled' do + Tartarus.should_receive(:logging_enabled?).and_return(false) + Tartarus.should_receive(:log).never + @controller.rescue_action_with_tartarus(@exception) end it 'should invoke rescue_action_without_tartarus' do @controller.should_receive(:rescue_action_without_tartarus)