errplane 1.0.0 → 1.0.1

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.
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+
3
+ describe Errplane::ExceptionPresenter do
4
+ before do
5
+ begin
6
+ 1/0
7
+ rescue Exception => e
8
+ @exception = e
9
+ end
10
+ end
11
+
12
+ describe ".new" do
13
+ it "should create a new ExceptionPresenter" do
14
+ exception_presenter = Errplane::ExceptionPresenter.new(@exception)
15
+ exception_presenter.should be_a(Errplane::ExceptionPresenter)
16
+ end
17
+
18
+ it "should accept an exception as a parameter" do
19
+ exception_presenter = Errplane::ExceptionPresenter.new(@exception)
20
+ exception_presenter.should_not be_nil
21
+ end
22
+ end
23
+
24
+ # describe "#to_json" do
25
+ # it "should return a JSON string" do
26
+ # exception_presenter = Errplane::ExceptionPresenter.new(@exception)
27
+ # json = JSON.parse(exception_presenter.to_json)
28
+
29
+ # json["message"].should == "divided by 0"
30
+ # json["time"].should_not be_nil
31
+ # json["backtrace"].should_not be_nil
32
+ # end
33
+
34
+ # it "should include a custom hash if defined in the errplane config" do
35
+ # Errplane.configure do |config|
36
+ # config.define_custom_exception_data do |exception_presenter|
37
+ # if exception_presenter.exception.class == ZeroDivisionError
38
+ # exception_presenter.hash = "some_hash"
39
+ # exception_presenter.custom_data[:extra_info] = "blah"
40
+ # end
41
+ # end
42
+ # end
43
+
44
+ # exception_presenter = Errplane::ExceptionPresenter.new(@exception)
45
+ # json = JSON.parse(exception_presenter.to_json)
46
+ # json["hash"].should == "some_hash"
47
+ # json["custom_data"]["extra_info"].should == "blah"
48
+ # end
49
+
50
+ # describe "environment variables" do
51
+ # it "should be filtered based on the contents of environment_variable_filters" do
52
+ # Errplane.configure do |config|
53
+ # config.environment_variable_filters = [/password/i]
54
+ # end
55
+
56
+ # exception_presenter = Errplane::ExceptionPresenter.new(
57
+ # :exception => @exception,
58
+ # :environment_variables => {
59
+ # "IMPORTANT_PASSWORD" => "sesame",
60
+ # "EDITOR" => "vim"
61
+ # })
62
+
63
+ # json = JSON.parse(exception_presenter.to_json)
64
+ # json["environment_variables"].size.should == 1
65
+ # json["environment_variables"].should == {"EDITOR" => "vim"}
66
+ # end
67
+ # end
68
+ # end
69
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errplane
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
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-07-03 00:00:00.000000000 Z
12
+ date: 2013-07-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -223,9 +223,9 @@ files:
223
223
  - spec/support/rails3/app.rb
224
224
  - spec/support/rails3/log/test.log
225
225
  - spec/unit/backtrace_spec.rb
226
- - spec/unit/black_box_spec.rb
227
226
  - spec/unit/configuration_spec.rb
228
227
  - spec/unit/errplane_spec.rb
228
+ - spec/unit/exception_presenter_spec.rb
229
229
  - spec/unit/max_queue_spec.rb
230
230
  - spec/unit/worker_spec.rb
231
231
  homepage: http://errplane.com
@@ -273,8 +273,8 @@ test_files:
273
273
  - spec/support/rails3/app.rb
274
274
  - spec/support/rails3/log/test.log
275
275
  - spec/unit/backtrace_spec.rb
276
- - spec/unit/black_box_spec.rb
277
276
  - spec/unit/configuration_spec.rb
278
277
  - spec/unit/errplane_spec.rb
278
+ - spec/unit/exception_presenter_spec.rb
279
279
  - spec/unit/max_queue_spec.rb
280
280
  - spec/unit/worker_spec.rb
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Errplane::BlackBox do
4
- before do
5
- begin
6
- 1/0
7
- rescue Exception => e
8
- @exception = e
9
- end
10
- end
11
-
12
- describe ".new" do
13
- it "should create a new BlackBox" do
14
- black_box = Errplane::BlackBox.new
15
- end
16
-
17
- it "should accept an exception as a parameter" do
18
-
19
- black_box = Errplane::BlackBox.new(:exception => @exception)
20
- black_box.should_not be_nil
21
- end
22
- end
23
-
24
- describe "#to_json" do
25
- it "should return a JSON string" do
26
- black_box = Errplane::BlackBox.new(:exception => @exception)
27
- json = JSON.parse(black_box.to_json)
28
-
29
- json["message"].should == "divided by 0"
30
- json["time"].should_not be_nil
31
- json["backtrace"].should_not be_nil
32
- end
33
-
34
- it "should include a custom hash if defined in the errplane config" do
35
- Errplane.configure do |config|
36
- config.define_custom_exception_data do |black_box|
37
- if black_box.exception.class == ZeroDivisionError
38
- black_box.hash = "some_hash"
39
- black_box.custom_data[:extra_info] = "blah"
40
- end
41
- end
42
- end
43
-
44
- black_box = Errplane::BlackBox.new(:exception => @exception)
45
- json = JSON.parse(black_box.to_json)
46
- json["hash"].should == "some_hash"
47
- json["custom_data"]["extra_info"].should == "blah"
48
- end
49
-
50
- describe "environment variables" do
51
- it "should be filtered based on the contents of environment_variable_filters" do
52
- Errplane.configure do |config|
53
- config.environment_variable_filters = [/password/i]
54
- end
55
-
56
- black_box = Errplane::BlackBox.new(
57
- :exception => @exception,
58
- :environment_variables => {
59
- "IMPORTANT_PASSWORD" => "sesame",
60
- "EDITOR" => "vim"
61
- })
62
-
63
- json = JSON.parse(black_box.to_json)
64
- json["environment_variables"].size.should == 1
65
- json["environment_variables"].should == {"EDITOR" => "vim"}
66
- end
67
- end
68
- end
69
- end