smoke_detector 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +45 -3
- data/lib/smoke_detector/engine.rb +1 -1
- data/lib/smoke_detector/middleware/javascript_monitors.rb +4 -3
- data/lib/smoke_detector/providers.rb +2 -2
- data/lib/smoke_detector/providers/airbrake.rb +2 -2
- data/lib/smoke_detector/providers/provider.rb +3 -2
- data/lib/smoke_detector/providers/rollbar.rb +10 -3
- data/lib/smoke_detector/version.rb +1 -1
- data/spec/dummy/config/initializers/smoke_detector.rb +3 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +2607 -1426
- data/spec/models/smoke_detector_spec.rb +2 -2
- data/spec/requests/middleware/javascript_monitors_spec.rb +56 -1
- metadata +4 -8
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -7
@@ -5,8 +5,8 @@ describe SmokeDetector do
|
|
5
5
|
let(:err) { Exception.new }
|
6
6
|
|
7
7
|
before do
|
8
|
-
SmokeDetector.register_provider(:airbrake, 'key', 'client_key')
|
9
|
-
SmokeDetector.register_provider(:rollbar, 'key', 'client_key')
|
8
|
+
SmokeDetector.register_provider(:airbrake, 'key', {api_key: 'client_key'})
|
9
|
+
SmokeDetector.register_provider(:rollbar, 'key', {api_key: 'client_key'})
|
10
10
|
SmokeDetector.providers.size.should > 1
|
11
11
|
end
|
12
12
|
|
@@ -15,7 +15,7 @@ describe SmokeDetector::JavaScriptMonitors do
|
|
15
15
|
|
16
16
|
context 'with a Rollbar client API key configured' do
|
17
17
|
before do
|
18
|
-
SmokeDetector.register_provider(:rollbar, 'key', 'client_key')
|
18
|
+
SmokeDetector.register_provider(:rollbar, 'key', {api_key: 'client_key' })
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'injects the Rollbar JS snippet into the <head>' do
|
@@ -35,4 +35,59 @@ describe SmokeDetector::JavaScriptMonitors do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
context 'hostWhitelist' do
|
39
|
+
before do
|
40
|
+
SmokeDetector.register_provider(:rollbar, 'key', {api_key: 'client_key', host_whitelist: host_whitelist})
|
41
|
+
end
|
42
|
+
|
43
|
+
shared_examples "a properly set hostWhiteList" do
|
44
|
+
it 'injects the Rollbar JS snippet into the <head>' do
|
45
|
+
get '/widgets'
|
46
|
+
rollbar_snippet = Nokogiri::HTML(response.body).css('head script:contains("_rollbarConfig")').children.first
|
47
|
+
expect(rollbar_snippet).to_not be_nil
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'sets hostWhitelist' do
|
51
|
+
get '/widgets'
|
52
|
+
script_content = Nokogiri::HTML(response.body).css('head script:contains("_rollbarConfig")').children.first
|
53
|
+
position = /hostWhiteList:\s*#{Regexp.escape(host_whitelist.to_s)}/i =~ script_content
|
54
|
+
expect(position).to_not be_nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'with hostWhitelist Rollbar client setting configured' do
|
59
|
+
let(:host_whitelist) { ['example.com', 'facebook.com'] }
|
60
|
+
it_behaves_like "a properly set hostWhiteList"
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'with hostWhitelist Rollbar client setting unset' do
|
64
|
+
let(:host_whitelist) { nil }
|
65
|
+
it_behaves_like "a properly set hostWhiteList"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'ignoredMessages' do
|
70
|
+
before do
|
71
|
+
SmokeDetector.register_provider(:rollbar, 'key', {api_key: 'client_key', ignored_messages: ignored_messages})
|
72
|
+
end
|
73
|
+
|
74
|
+
shared_examples "a properly set ignoredMessages" do
|
75
|
+
it 'injects the Rollbar JS snippet into the <head> with ignoredMessages set' do
|
76
|
+
get '/widgets'
|
77
|
+
script_content = Nokogiri::HTML(response.body).css('head script:contains("_rollbarConfig")').children.first
|
78
|
+
position = /ignoredMessages:\s*#{Regexp.escape(ignored_messages.to_s)}/i =~ script_content
|
79
|
+
expect(position).to_not be_nil
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context "with ignoredMessages Rollbar client setting configured" do
|
84
|
+
let(:ignored_messages) { ['Error: Llamas are actually pretty cool.', 'Exception: The jerkstore called, and they ran out of you.'] }
|
85
|
+
it_behaves_like "a properly set ignoredMessages"
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'with ignoredMessages Rollbar client setting unset' do
|
89
|
+
let(:ignored_messages) { nil }
|
90
|
+
it_behaves_like "a properly set ignoredMessages"
|
91
|
+
end
|
92
|
+
end
|
38
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smoke_detector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Friedrich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,10 +211,8 @@ files:
|
|
211
211
|
- spec/dummy/config/locales/en.yml
|
212
212
|
- spec/dummy/config/routes.rb
|
213
213
|
- spec/dummy/config.ru
|
214
|
-
- spec/dummy/db/development.sqlite3
|
215
214
|
- spec/dummy/db/schema.rb
|
216
215
|
- spec/dummy/db/test.sqlite3
|
217
|
-
- spec/dummy/log/development.log
|
218
216
|
- spec/dummy/log/test.log
|
219
217
|
- spec/dummy/public/404.html
|
220
218
|
- spec/dummy/public/422.html
|
@@ -284,10 +282,8 @@ test_files:
|
|
284
282
|
- spec/dummy/config/locales/en.yml
|
285
283
|
- spec/dummy/config/routes.rb
|
286
284
|
- spec/dummy/config.ru
|
287
|
-
- spec/dummy/db/development.sqlite3
|
288
285
|
- spec/dummy/db/schema.rb
|
289
286
|
- spec/dummy/db/test.sqlite3
|
290
|
-
- spec/dummy/log/development.log
|
291
287
|
- spec/dummy/log/test.log
|
292
288
|
- spec/dummy/public/404.html
|
293
289
|
- spec/dummy/public/422.html
|
Binary file
|
@@ -1,7 +0,0 @@
|
|
1
|
-
Connecting to database specified by database.yml
|
2
|
-
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
3
|
-
[1m[35m (0.9ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
4
|
-
[1m[36m (0.7ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
5
|
-
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
6
|
-
[1m[36m (0.7ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
7
|
-
[1m[35m (1.2ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|