Sha256: 48db0046db76d66a18b4d063812efb9fe867c0b725e47d89c4d8e315fd92d10a

Contents?: true

Size: 1.08 KB

Versions: 10

Compression:

Stored size: 1.08 KB

Contents

require File.dirname(__FILE__) + '/test_helper'
require 'action_controller/test_process'

class ExceptionNotifierTest < Test::Unit::TestCase
  
  def setup
    @controller = ActionController::Base.new
    @controller.request = ActionController::TestRequest.new
    @controller.response = ActionController::TestResponse.new
    @controller.params = {}
    @controller.send(:initialize_current_url)
    ActionController::Base.consider_all_requests_local = false
    @@delivered_mail = []
    ActionMailer::Base.class_eval do
      def deliver!(mail = @mail)
        @@delivered_mail << mail
      end
    end
  end

  def test_should_generate_message_without_controller
    begin
      raise 'problem'
    rescue RuntimeError => e
      assert_nothing_raised do
        ExceptionNotifier.deliver_exception_notification(e)
      end
    end
  end

  def test_should_generate_message_with_controller
    begin
      raise 'problem'
    rescue RuntimeError => e
      assert_nothing_raised do
        ExceptionNotifier.deliver_exception_notification(e, @controller, @controller.request)
      end
    end
  end

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
super_exception_notifier-2.0.8 test/exception_notifier_test.rb
super_exception_notifier-2.0.7 test/exception_notifier_test.rb
super_exception_notifier-2.0.6 test/exception_notifier_test.rb
super_exception_notifier-2.0.5 test/exception_notifier_test.rb
bmpercy-exception_notification-2.0.5 test/exception_notifier_test.rb
super_exception_notifier-2.0.4 test/exception_notifier_test.rb
super_exception_notifier-2.0.3 test/exception_notifier_test.rb
super_exception_notifier-2.0.2 test/exception_notifier_test.rb
super_exception_notifier-2.0.1 test/exception_notifier_test.rb
super_exception_notifier-2.0.0 test/exception_notifier_test.rb