exceptional 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = %q{exceptional}
4
- s.version = "2.0.3"
4
+ s.version = "2.0.4"
5
5
  s.authors = ["Contrast"]
6
6
  s.summary = %q{Exceptional is the core Ruby library for communicating with http://getexceptional.com (hosted error tracking service)}
7
7
  s.description = %q{Exceptional is the core Ruby library for communicating with http://getexceptional.com (hosted error tracking service). Use it to find out about errors that happen in your live app. It captures lots of helpful information to help you fix the errors.}
@@ -28,7 +28,7 @@ module Exceptional
28
28
 
29
29
  def context_stuff
30
30
  context = Thread.current[:exceptional_context]
31
- context.blank? ? {} : {'context' => context}
31
+ (context.nil? || context.empty?) ? {} : {'context' => context}
32
32
  end
33
33
 
34
34
  def to_json
@@ -45,7 +45,7 @@ module Exceptional
45
45
  end
46
46
 
47
47
  def uniqueness_hash
48
- return nil if @exception.backtrace.blank?
48
+ return nil if (@exception.backtrace.nil? || @exception.backtrace.empty?)
49
49
  Digest::MD5.hexdigest(@exception.backtrace.join)
50
50
  end
51
51
 
@@ -4,11 +4,14 @@ module Exceptional
4
4
  end
5
5
 
6
6
  def self.test
7
- data = Exceptional::ExceptionData.new(ExceptionalTestException.new, 'Test exception')
8
- unless Exceptional::Remote.error(data)
9
- puts "Problem sending exception to Exceptional. Check your API key."
10
- else
11
- puts "Exception sent successfully."
7
+ begin
8
+ raise ExceptionalTestException.new, 'Test exception'
9
+ rescue Exception => e
10
+ unless Exceptional::Remote.error(Exceptional::ExceptionData.new(e, "Test Exception"))
11
+ puts "Problem sending exception to Exceptional. Check your API key."
12
+ else
13
+ puts "Exception sent successfully."
14
+ end
12
15
  end
13
16
  end
14
17
  end
@@ -1,6 +1,7 @@
1
1
  require 'zlib'
2
2
  require 'cgi'
3
3
  require 'net/http'
4
+ require 'net/https'
4
5
  require 'digest/md5'
5
6
 
6
7
  module Exceptional
@@ -145,4 +145,18 @@ describe Exceptional::ControllerExceptionData, 'with request/controller/params'
145
145
  data = Exceptional::ControllerExceptionData.new(myException)
146
146
  data.uniqueness_hash.should == Digest::MD5.hexdigest('123')
147
147
  end
148
+
149
+ it "creates a nil uniqueness_hash if nil backtrace" do
150
+ myException = Exception.new
151
+ myException.stub!(:backtrace).and_return(nil)
152
+ data = Exceptional::ControllerExceptionData.new(myException)
153
+ data.uniqueness_hash.should == nil
154
+ end
155
+
156
+ it "creates a uniqueness_hash from backtrace" do
157
+ myException = Exception.new
158
+ myException.stub!(:backtrace).and_return([])
159
+ data = Exceptional::ControllerExceptionData.new(myException)
160
+ data.uniqueness_hash.should == nil
161
+ end
148
162
  end
@@ -14,6 +14,8 @@ describe ActiveSupport::JSON, 'standards compliant json' do
14
14
  end
15
15
 
16
16
  class TestingController < ActionController::Base
17
+ filter_parameter_logging :password, /credit_card/
18
+
17
19
  def raises_something
18
20
  raise StandardError
19
21
  end
@@ -34,6 +36,14 @@ describe TestingController do
34
36
  send_request(:raises_something)
35
37
  @response.code.should == '500'
36
38
  end
39
+
40
+ it "filters paramaters based on controller filter_parameter_logging" do
41
+ Exceptional::Config.stub!(:should_send_to_api?).and_return(true)
42
+ Exceptional::Remote.should_receive(:error) {|exception_data|
43
+ exception_data.to_hash['request']['parameters']['credit_card_number'].should == '[FILTERED]'
44
+ }
45
+ send_request(:raises_something, {:credit_card_number => '1234566777775453', :something_else => 'boo'})
46
+ end
37
47
  end
38
48
 
39
49
  if ActionController::Base.respond_to?(:rescue_from)
@@ -13,8 +13,10 @@ ENV['RAILS_ENV'] = 'test'
13
13
  require 'action_controller'
14
14
  require 'action_controller/test_process'
15
15
 
16
- def send_request(action = nil)
16
+ def send_request(action = nil,params={})
17
17
  @request = ActionController::TestRequest.new
18
+ @request.query_parameters = @request.query_parameters.merge(params)
19
+ @request.stub!(:request_method).and_return('GET')
18
20
  @request.action = action ? action.to_s : ""
19
21
  @response = ActionController::TestResponse.new
20
22
  @controller.process(@request, @response)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exceptional
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contrast
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-05 00:00:00 +00:00
12
+ date: 2010-01-12 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15