airbrake 3.1.7 → 3.1.8
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.
- data/CHANGELOG +12 -0
- data/features/rails.feature +4 -0
- data/features/step_definitions/rails_application_steps.rb +14 -0
- data/lib/airbrake.rb +9 -1
- data/lib/airbrake/rails/controller_methods.rb +1 -0
- data/lib/airbrake/railtie.rb +12 -1
- data/lib/airbrake/version.rb +1 -1
- data/test/controller_methods_test.rb +37 -0
- metadata +4 -2
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
Version 3.1.8 - 2013-02-05 16:29:43 +0100
|
|
2
|
+
===============================================================================
|
|
3
|
+
|
|
4
|
+
Hrvoje Šimić (5):
|
|
5
|
+
rename SUPPORTED_RAILS_VERSIONS to TESTED_AGAINST
|
|
6
|
+
don't call id on nil - fixes #177
|
|
7
|
+
move our middleware right after exception middleware (#178)
|
|
8
|
+
implement tests for #178
|
|
9
|
+
be nice to older rails versions
|
|
10
|
+
|
|
11
|
+
|
|
1
12
|
Version 3.1.7 - 2013-01-28 13:35:10 +0100
|
|
2
13
|
===============================================================================
|
|
3
14
|
|
|
@@ -1058,3 +1069,4 @@ Nick Quaranto (3):
|
|
|
1058
1069
|
|
|
1059
1070
|
|
|
1060
1071
|
|
|
1072
|
+
|
data/features/rails.feature
CHANGED
|
@@ -249,3 +249,7 @@ Feature: Install the Gem in a Rails application
|
|
|
249
249
|
And I perform a request to "http://example.com:123/test/index" in the "production" environment
|
|
250
250
|
Then I should receive a Airbrake notification
|
|
251
251
|
And the Airbrake notification should contain the framework information
|
|
252
|
+
|
|
253
|
+
Scenario: Middleware should be correctly placed
|
|
254
|
+
When I list the application's middleware and save it into a file
|
|
255
|
+
Then the Airbrake middleware should be placed correctly
|
|
@@ -244,3 +244,17 @@ end
|
|
|
244
244
|
Then /^the Airbrake notification should contain the framework information$/ do
|
|
245
245
|
step %{the output should contain "Rails: #{ENV["RAILS_VERSION"]}"}
|
|
246
246
|
end
|
|
247
|
+
|
|
248
|
+
When /^I list the application's middleware and save it into a file$/ do
|
|
249
|
+
step %{I run `bash -c 'bundle exec rake middleware > middleware.dump'`}
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
Then /^the Airbrake middleware should be placed correctly$/ do
|
|
253
|
+
middleware_file = File.join(LOCAL_RAILS_ROOT, 'middleware.dump')
|
|
254
|
+
middleware = File.read(middleware_file).split(/\n/)
|
|
255
|
+
airbrake_index = middleware.rindex("use Airbrake::Rails::Middleware")
|
|
256
|
+
middleware_index = middleware.rindex("use ActionDispatch::DebugExceptions") ||
|
|
257
|
+
middleware.rindex("use ActionDispatch::ShowExceptions")
|
|
258
|
+
(airbrake_index > middleware_index).should be_true
|
|
259
|
+
end
|
|
260
|
+
|
data/lib/airbrake.rb
CHANGED
|
@@ -6,7 +6,15 @@ end
|
|
|
6
6
|
require 'net/http'
|
|
7
7
|
require 'net/https'
|
|
8
8
|
require 'rubygems'
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
begin
|
|
11
|
+
require 'active_support/core_ext/object/blank'
|
|
12
|
+
rescue
|
|
13
|
+
require 'activesupport'
|
|
14
|
+
require 'activesupport/core_ext'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
10
18
|
require 'airbrake/version'
|
|
11
19
|
require 'airbrake/configuration'
|
|
12
20
|
require 'airbrake/notice'
|
|
@@ -75,6 +75,7 @@ module Airbrake
|
|
|
75
75
|
def airbrake_current_user
|
|
76
76
|
user = begin current_user rescue current_member end
|
|
77
77
|
h = {}
|
|
78
|
+
return h if user.nil?
|
|
78
79
|
Airbrake.configuration.user_attributes.map(&:to_sym).each do |attr|
|
|
79
80
|
h[attr.to_sym] = user.send(attr) if user.respond_to? attr
|
|
80
81
|
end
|
data/lib/airbrake/railtie.rb
CHANGED
|
@@ -11,7 +11,18 @@ module Airbrake
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
initializer "airbrake.middleware" do |app|
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
middleware = if defined?(ActionDispatch::DebugExceptions)
|
|
16
|
+
# Rails >= 3.2.0
|
|
17
|
+
"ActionDispatch::DebugExceptions"
|
|
18
|
+
else
|
|
19
|
+
# Rails < 3.2.0
|
|
20
|
+
"ActionDispatch::ShowExceptions"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
app.config.middleware.insert_after middleware,
|
|
24
|
+
"Airbrake::Rails::Middleware"
|
|
25
|
+
|
|
15
26
|
app.config.middleware.insert 0, "Airbrake::UserInformer"
|
|
16
27
|
end
|
|
17
28
|
|
data/lib/airbrake/version.rb
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require File.expand_path '../helper', __FILE__
|
|
2
|
+
|
|
3
|
+
require 'airbrake/rails/controller_methods'
|
|
4
|
+
|
|
5
|
+
class TestController
|
|
6
|
+
include Airbrake::Rails::ControllerMethods
|
|
7
|
+
|
|
8
|
+
def current_user
|
|
9
|
+
nil
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class ControllerMethodsTest < Test::Unit::TestCase
|
|
14
|
+
context "#airbrake_current_user" do
|
|
15
|
+
setup do
|
|
16
|
+
|
|
17
|
+
NilClass.class_eval do
|
|
18
|
+
@@called = false
|
|
19
|
+
|
|
20
|
+
def self.called
|
|
21
|
+
!! @@called
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def id
|
|
25
|
+
@@called = true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
@controller = TestController.new
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
should "not call #id on NilClass" do
|
|
33
|
+
@controller.send(:airbrake_current_user)
|
|
34
|
+
assert_equal false, NilClass.called
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
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.
|
|
4
|
+
version: 3.1.8
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-02-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: builder
|
|
@@ -329,6 +329,7 @@ files:
|
|
|
329
329
|
- README.md
|
|
330
330
|
- TESTED_AGAINST
|
|
331
331
|
- install.rb
|
|
332
|
+
- test/controller_methods_test.rb
|
|
332
333
|
- test/configuration_test.rb
|
|
333
334
|
- test/airbrake_tasks_test.rb
|
|
334
335
|
- test/catcher_test.rb
|
|
@@ -387,6 +388,7 @@ signing_key:
|
|
|
387
388
|
specification_version: 3
|
|
388
389
|
summary: Send your application errors to our hosted service and reclaim your inbox.
|
|
389
390
|
test_files:
|
|
391
|
+
- test/controller_methods_test.rb
|
|
390
392
|
- test/configuration_test.rb
|
|
391
393
|
- test/airbrake_tasks_test.rb
|
|
392
394
|
- test/catcher_test.rb
|