airbrake 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ Version 3.1.2 - 2012-06-23 02:27:01 +0200
2
+ ===============================================================================
3
+
4
+ Hrvoje Šimić (5):
5
+ routing errors ignored by default, for #92
6
+ use simplecov for test coverage
7
+ fix features for javascript
8
+ ignore user agents in rack, closes #61
9
+ error out if controller is undefined
10
+
11
+
1
12
  Version 3.1.1 - 2012-06-06 20:35:00 -0700
2
13
  ===============================================================================
3
14
 
@@ -821,3 +832,4 @@ Nick Quaranto (3):
821
832
 
822
833
 
823
834
 
835
+
data/Gemfile CHANGED
@@ -7,5 +7,6 @@ if true
7
7
  gem 'pry'
8
8
  gem 'guard'
9
9
  gem 'guard-test'
10
+ gem 'simplecov'
10
11
  end
11
- end
12
+ end
@@ -21,3 +21,36 @@ Feature: Use the notifier in a plain Rack app
21
21
  When I perform a Rack request to "http://example.com:123/test/index?param=value"
22
22
  Then I should receive a Airbrake notification
23
23
 
24
+ Scenario: Ignore user agents
25
+ Given the following Rack app:
26
+ """
27
+ require 'rack'
28
+ require 'airbrake'
29
+
30
+ Airbrake.configure do |config|
31
+ config.api_key = 'my_api_key'
32
+ config.ignore_user_agent << /ignore/
33
+ end
34
+
35
+ class Mock
36
+ class AppendUserAgent
37
+ def initialize(app)
38
+ @app = app
39
+ end
40
+
41
+ def call(env)
42
+ env["HTTP_USER_AGENT"] = "ignore"
43
+ @app.call(env)
44
+ end
45
+ end
46
+ end
47
+
48
+ app = Rack::Builder.app do
49
+ use Airbrake::Rack
50
+ use Mock::AppendUserAgent
51
+ run lambda { |env| raise "Rack down" }
52
+ end
53
+ """
54
+ When I perform a Rack request to "http://example.com:123/test/index?param=value"
55
+ Then I should not see "** [Airbrake] Response from Airbrake:"
56
+
@@ -202,6 +202,10 @@ Feature: Install the Gem in a Rails application
202
202
  Scenario: Reporting 404s
203
203
  When I configure the Airbrake shim
204
204
  And I configure usage of Airbrake
205
+ And I configure the notifier to use the following configuration lines:
206
+ """
207
+ config.ignore_only = []
208
+ """
205
209
  And I perform a request to "http://example.com:123/this/route/does/not/exist"
206
- And I should see "The page you were looking for doesn't exist."
210
+ Then I should see "The page you were looking for doesn't exist."
207
211
  And I should receive a Airbrake notification
@@ -122,6 +122,9 @@ module RailsHelpers
122
122
  env = Rack::MockRequest.env_for(#{uri.inspect})
123
123
  response = RailsRoot::Application.call(env)
124
124
 
125
+
126
+ response = response.last if response.last.is_a?(ActionDispatch::Response)
127
+
125
128
  if response.is_a?(Array)
126
129
  puts response.join
127
130
  else
@@ -44,7 +44,7 @@ task :airbrake_not_yet_configured do
44
44
  end
45
45
 
46
46
  module Airbrake
47
- def self.notify(*args)
47
+ def self.notify_or_ignore(*args)
48
48
  # TODO if you need to check more params, you'll have to use json.dump or something
49
49
  $stderr.puts "airbrake #{args[1][:component]}"
50
50
  end
@@ -25,18 +25,28 @@ module Airbrake
25
25
  Airbrake.configuration.logger ||= Logger.new STDOUT
26
26
  end
27
27
 
28
+ def ignored_user_agent?(env)
29
+ true if Airbrake.
30
+ configuration.
31
+ ignore_user_agent.
32
+ flatten.
33
+ any? { |ua| ua === env['HTTP_USER_AGENT'] }
34
+ end
35
+
36
+ def notify_airbrake(exception,env)
37
+ Airbrake.notify_or_ignore(exception,:rack_env => env) unless ignored_user_agent?(env)
38
+ end
39
+
28
40
  def call(env)
29
41
  begin
30
42
  response = @app.call(env)
31
43
  rescue Exception => raised
32
- error_id = Airbrake.notify_or_ignore(raised, :rack_env => env)
33
- env['airbrake.error_id'] = error_id
44
+ env['airbrake.error_id'] = notify_airbrake(raised,env)
34
45
  raise
35
46
  end
36
47
 
37
48
  if env['rack.exception']
38
- error_id = Airbrake.notify_or_ignore(env['rack.exception'], :rack_env => env)
39
- env['airbrake.error_id'] = error_id
49
+ env['airbrake.error_id'] = notify_airbrake(env['rack.exception'],env)
40
50
  end
41
51
 
42
52
  response
@@ -16,8 +16,8 @@ module Airbrake
16
16
  def render_exception_with_airbrake(env,exception)
17
17
  controller = env['action_controller.instance']
18
18
  env['airbrake.error_id'] = Airbrake.
19
- notify(exception,
20
- controller.try(:airbrake_request_data) || :rack_env => env) unless skip_user_agent?(env)
19
+ notify_or_ignore(exception,
20
+ controller.try(:airbrake_request_data) || {:rack_env => env}) unless skip_user_agent?(env)
21
21
  if defined?(controller.rescue_action_in_public_without_airbrake)
22
22
  controller.rescue_action_in_public_without_airbrake(exception)
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Airbrake
2
- VERSION = "3.1.1".freeze
2
+ VERSION = "3.1.2".freeze
3
3
  end
@@ -1,3 +1,5 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
1
3
  require 'test/unit'
2
4
  require 'rubygems'
3
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-07 00:00:00.000000000Z
12
+ date: 2012-06-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
16
- requirement: &70339779074320 !ruby/object:Gem::Requirement
16
+ requirement: &70111147519640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70339779074320
24
+ version_requirements: *70111147519640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &70339779073820 !ruby/object:Gem::Requirement
27
+ requirement: &70111147517460 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70339779073820
35
+ version_requirements: *70111147517460
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: actionpack
38
- requirement: &70339779073120 !ruby/object:Gem::Requirement
38
+ requirement: &70111147515340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.3.8
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70339779073120
46
+ version_requirements: *70111147515340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activerecord
49
- requirement: &70339779071900 !ruby/object:Gem::Requirement
49
+ requirement: &70111147514720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.3.8
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70339779071900
57
+ version_requirements: *70111147514720
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activesupport
60
- requirement: &70339779071440 !ruby/object:Gem::Requirement
60
+ requirement: &70111147514140 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 2.3.8
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70339779071440
68
+ version_requirements: *70111147514140
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bourne
71
- requirement: &70339779070860 !ruby/object:Gem::Requirement
71
+ requirement: &70111147513560 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '1.0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70339779070860
79
+ version_requirements: *70111147513560
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: cucumber
82
- requirement: &70339779070400 !ruby/object:Gem::Requirement
82
+ requirement: &70111147512980 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.10.6
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70339779070400
90
+ version_requirements: *70111147512980
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: fakeweb
93
- requirement: &70339779069940 !ruby/object:Gem::Requirement
93
+ requirement: &70111147494720 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 1.3.0
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70339779069940
101
+ version_requirements: *70111147494720
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: nokogiri
104
- requirement: &70339779069460 !ruby/object:Gem::Requirement
104
+ requirement: &70111147494200 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 1.4.3.1
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70339779069460
112
+ version_requirements: *70111147494200
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rspec
115
- requirement: &70339779069000 !ruby/object:Gem::Requirement
115
+ requirement: &70111147493680 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: 2.6.0
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70339779069000
123
+ version_requirements: *70111147493680
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: sham_rack
126
- requirement: &70339779068540 !ruby/object:Gem::Requirement
126
+ requirement: &70111147493100 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 1.3.0
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70339779068540
134
+ version_requirements: *70111147493100
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: shoulda
137
- requirement: &70339779068080 !ruby/object:Gem::Requirement
137
+ requirement: &70111147492520 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: 2.11.3
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *70339779068080
145
+ version_requirements: *70111147492520
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: capistrano
148
- requirement: &70339779067620 !ruby/object:Gem::Requirement
148
+ requirement: &70111147491960 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ~>
@@ -153,7 +153,7 @@ dependencies:
153
153
  version: 2.8.0
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *70339779067620
156
+ version_requirements: *70111147491960
157
157
  description:
158
158
  email: support@airbrake.io
159
159
  executables: []