rnotifier 0.1.3 → 0.1.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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/bin/rnotifier +2 -0
- data/lib/rnotifier/config_test.rb +4 -3
- data/lib/rnotifier/exception_code.rb +1 -1
- data/lib/rnotifier/version.rb +1 -1
- data/spec/config_test_spec.rb +36 -0
- data/spec/exception_code_spec.rb +24 -0
- data/spec/fixtures/rnotifier_without_env.yaml +1 -0
- data/spec/spec_helper.rb +1 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cef52d8a3834d6330dac03da18ad5818b39d4827
|
4
|
+
data.tar.gz: 8f43aefa2e62a789143777ef5611159913492f93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 469d40fde0290c0358022b086a3090c7e27d1096cc016a83691ec6f87cdf827695539d8ace509ea5e204caaf80a84373b71f3fe540f0c86db2ab75ae464e4c79
|
7
|
+
data.tar.gz: 73f0251a3f9b57930b637e14f9bff14e4db7a6d36f4b3e71ccef4b32a3dd07f1ef0b8d6f918e03882a3d40e47798a9f3b0d7fecccf5740b559d57605cf91649e
|
data/.gitignore
CHANGED
data/bin/rnotifier
CHANGED
@@ -17,6 +17,8 @@ install api-key [environments] #Create config/rnotifier.yaml with api_key and en
|
|
17
17
|
require 'rnotifier/config_test.rb'
|
18
18
|
ENV['RACK_ENV'] = 'rnotifier_test'
|
19
19
|
Rnotifier.load_config('config/rnotifier.yaml')
|
20
|
+
Rnotifier::Config.environments = [ENV['RACK_ENV']]
|
21
|
+
Rnotifier::Config.init
|
20
22
|
if Rnotifier::Config.valid?
|
21
23
|
Rnotifier::ConfigTest.test
|
22
24
|
else
|
@@ -7,11 +7,12 @@ module Rnotifier
|
|
7
7
|
begin
|
8
8
|
raise TestException.new('Test exception')
|
9
9
|
rescue Exception => e
|
10
|
-
if Rnotifier
|
11
|
-
puts "Test Exception sent. Login to rnotifier.com and checkout."
|
10
|
+
if status = Rnotifier.exception(e, {})
|
11
|
+
puts "Test Exception sent. Login to www.rnotifier.com and checkout."
|
12
12
|
else
|
13
|
-
puts "Problem sending exception to rnotifier.com. Check your API key or config."
|
13
|
+
puts "Problem sending exception to www.rnotifier.com. Check your API key or config."
|
14
14
|
end
|
15
|
+
status
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
data/lib/rnotifier/version.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Rnotifier::ConfigTest do
|
5
|
+
|
6
|
+
after(:each) do
|
7
|
+
ENV['RACK_ENV'] = 'test'
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'sends test exception exception' do
|
11
|
+
rnotifier_init
|
12
|
+
stubs = stub_faraday_request
|
13
|
+
|
14
|
+
expect(Rnotifier::ConfigTest.test).to be_true
|
15
|
+
expect(Rnotifier::Config.api_key).to eq 'API-KEY'
|
16
|
+
expect {stubs.verify_stubbed_calls }.to_not raise_error
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'sends test exception for rnotifier_test env' do
|
20
|
+
|
21
|
+
['rnotifier_without_env', 'rnotifier'].each do |c|
|
22
|
+
stubs = stub_faraday_request
|
23
|
+
|
24
|
+
ENV['RACK_ENV'] = 'rnotifier_test'
|
25
|
+
Rnotifier.load_config("#{Dir.pwd}/spec/fixtures/#{c}.yaml")
|
26
|
+
Rnotifier::Config.environments = [ENV['RACK_ENV']]
|
27
|
+
Rnotifier::Config.init
|
28
|
+
|
29
|
+
expect(Rnotifier::Config.valid?).to be_true
|
30
|
+
expect(Rnotifier::Config.api_key).to eq 'API-KEY'
|
31
|
+
expect(Rnotifier::ConfigTest.test).to be_true
|
32
|
+
expect {stubs.verify_stubbed_calls }.to_not raise_error
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/spec/exception_code_spec.rb
CHANGED
@@ -63,4 +63,28 @@ describe Rnotifier::ExceptionCode do
|
|
63
63
|
expect(code).to eq([6].concat(lines))
|
64
64
|
end
|
65
65
|
|
66
|
+
it 'return nil if backtrace is nil' do
|
67
|
+
rnotifier_init
|
68
|
+
|
69
|
+
e = Exception.new('No backtrace')
|
70
|
+
code = Rnotifier::ExceptionCode.get(e)
|
71
|
+
|
72
|
+
expect(code).to be_nil
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'return first line of backtrace if exception not a systax error or not rails form app' do
|
76
|
+
rnotifier_init
|
77
|
+
Rnotifier::Config.app_env[:app_root] = '/noroot'
|
78
|
+
|
79
|
+
e = Exception.new('Non app exception')
|
80
|
+
e.set_backtrace([File.dirname(__FILE__) + "/mock_exception_helper.rb:3:in `mock_exception'"])
|
81
|
+
|
82
|
+
code = Rnotifier::ExceptionCode.get(e)
|
83
|
+
lines = File.readlines(File.dirname(__FILE__) + "/mock_exception_helper.rb")[0..5]
|
84
|
+
|
85
|
+
expect(code).to eq([0].concat(lines))
|
86
|
+
rnotifier_init
|
87
|
+
end
|
88
|
+
|
89
|
+
|
66
90
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
apikey: API-KEY
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rnotifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jiren Patel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/rnotifier/version.rb
|
140
140
|
- rnotifier.gemspec
|
141
141
|
- spec/config_spec.rb
|
142
|
+
- spec/config_test_spec.rb
|
142
143
|
- spec/event_data_spec.rb
|
143
144
|
- spec/exception_code_spec.rb
|
144
145
|
- spec/exception_data_spec.rb
|
@@ -146,6 +147,7 @@ files:
|
|
146
147
|
- spec/fixtures/rnotifier.yaml
|
147
148
|
- spec/fixtures/rnotifier_ignore_env.yaml
|
148
149
|
- spec/fixtures/rnotifier_test.yaml
|
150
|
+
- spec/fixtures/rnotifier_without_env.yaml
|
149
151
|
- spec/fixtures/test_sinatra_app.rb
|
150
152
|
- spec/mock_exception_helper.rb
|
151
153
|
- spec/rack_middleware_spec.rb
|
@@ -176,6 +178,7 @@ specification_version: 4
|
|
176
178
|
summary: Exception catcher for Rails and other Rack apps
|
177
179
|
test_files:
|
178
180
|
- spec/config_spec.rb
|
181
|
+
- spec/config_test_spec.rb
|
179
182
|
- spec/event_data_spec.rb
|
180
183
|
- spec/exception_code_spec.rb
|
181
184
|
- spec/exception_data_spec.rb
|
@@ -183,6 +186,7 @@ test_files:
|
|
183
186
|
- spec/fixtures/rnotifier.yaml
|
184
187
|
- spec/fixtures/rnotifier_ignore_env.yaml
|
185
188
|
- spec/fixtures/rnotifier_test.yaml
|
189
|
+
- spec/fixtures/rnotifier_without_env.yaml
|
186
190
|
- spec/fixtures/test_sinatra_app.rb
|
187
191
|
- spec/mock_exception_helper.rb
|
188
192
|
- spec/rack_middleware_spec.rb
|