Sha256: c400d01bad43d6da2622a29e9a3b44345e7028890c51cfd7e1e0e3b1087d8de1

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

require 'example_helper'
require 'chatterbox/exception_notification'
require File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. .. rails init]))

describe Chatterbox::RailsCatcher do
  
  def helper
    @helper ||= Class.new do
      def rescue_action_in_public(exception); end
      def self.hide_action(*name); end
      
      include Chatterbox::RailsCatcher
    end.new
  end
  
  describe "rescue_action_in_public_with_chatterbox" do
    describe "when request is not available" do
      it "sends exception and request hash to ExceptionNotification" do
        exception = stub_everything
        helper.stubs(:request).returns(request = stub_everything)
        Chatterbox::ExceptionNotification.expects(:handle).with(:exception => exception, :request => request)
        helper.rescue_action_in_public_with_chatterbox(exception)
      end
    end
    
    describe "when request is not available" do
      it "sends the exception hash on to ExceptionNotification" do
        Chatterbox::ExceptionNotification.expects(:handle).with(:exception => (exception = stub))
        helper.rescue_action_in_public_with_chatterbox(exception)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
chatterbox-0.8.5 examples/lib/chatterbox/rails_catcher_example.rb
chatterbox-0.8.4 examples/lib/chatterbox/rails_catcher_example.rb
chatterbox-0.8.3 examples/lib/chatterbox/rails_catcher_example.rb
chatterbox-0.8.2 examples/lib/chatterbox/rails_catcher_example.rb
chatterbox-0.8.1 examples/lib/chatterbox/rails_catcher_example.rb
chatterbox-0.6.2 examples/lib/chatterbox/rails_catcher_example.rb
chatterbox-0.6.1 examples/lib/chatterbox/rails_catcher_example.rb
chatterbox-0.6.0 examples/lib/chatterbox/rails_catcher_example.rb