pliny 0.17.0 → 0.17.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.
- checksums.yaml +4 -4
- data/lib/pliny/version.rb +1 -1
- data/spec/commands/generator_spec.rb +1 -3
- data/spec/commands/updater_spec.rb +1 -1
- data/spec/error_reporter_spec.rb +3 -3
- data/spec/helpers/encode_spec.rb +2 -2
- data/spec/log_spec.rb +11 -11
- data/spec/middleware/instruments_spec.rb +4 -4
- data/spec/middleware/request_store_spec.rb +2 -2
- data/spec/middleware/rescue_errors_spec.rb +1 -1
- data/spec/middleware/versioning_spec.rb +0 -1
- data/spec/rollbar_logger_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +2 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56651d8e3b670e7954a475c9d8cb04cc0124099f
|
4
|
+
data.tar.gz: ad7701bdf942d068994be11da8b3ceb7bc231082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d73cbdd0b3dcde8423dc2743af931738bc41a5d608281a031f29a160ac9cee73d8e40a7dac34274e0b619e9b695487c464286efcd412c20e79f8e61f4b03d09d
|
7
|
+
data.tar.gz: cf7bc5313022abc17ebee414f53ad004d66cd3177bee895daf8b7ba755451ee93602f41a0b128c9b1f9658cdeda1bebbf291a67a8ed2f424f8867246421978e0
|
data/lib/pliny/version.rb
CHANGED
@@ -9,9 +9,7 @@ describe Pliny::Commands::Generator do
|
|
9
9
|
before do
|
10
10
|
Timecop.freeze(@t = Time.now)
|
11
11
|
|
12
|
-
|
13
|
-
stub(klass).display
|
14
|
-
end
|
12
|
+
allow_any_instance_of(Pliny::Commands::Generator::Base).to receive(:display)
|
15
13
|
end
|
16
14
|
|
17
15
|
around do |example|
|
data/spec/error_reporter_spec.rb
CHANGED
@@ -14,9 +14,9 @@ describe Pliny::ErrorReporter do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "notifies rollbar" do
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
expect_any_instance_of(Pliny::ErrorReporter::RollbarReporter).
|
18
|
+
to receive(:notify).
|
19
|
+
with(exception, context: context, rack_env: rack_env)
|
20
20
|
|
21
21
|
notify_reporter
|
22
22
|
end
|
data/spec/helpers/encode_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe Pliny::Helpers::Encode do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
before do
|
14
|
-
|
14
|
+
allow(Config).to receive(:pretty_json) { false }
|
15
15
|
end
|
16
16
|
|
17
17
|
it "sets the Content-Type" do
|
@@ -33,7 +33,7 @@ describe Pliny::Helpers::Encode do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "encodes in pretty mode when set by config" do
|
36
|
-
|
36
|
+
allow(Config).to receive(:pretty_json) { true }
|
37
37
|
payload = { "foo" => "bar" }
|
38
38
|
post "/", payload
|
39
39
|
assert_equal MultiJson.encode(payload, pretty: true), last_response.body
|
data/spec/log_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Pliny::Log do
|
|
5
5
|
@io = StringIO.new
|
6
6
|
Pliny.stdout = @io
|
7
7
|
Pliny.stderr = @io
|
8
|
-
|
8
|
+
allow(@io).to receive(:print)
|
9
9
|
end
|
10
10
|
|
11
11
|
after do
|
@@ -13,7 +13,7 @@ describe Pliny::Log do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "logs in structured format" do
|
16
|
-
|
16
|
+
expect(@io).to receive(:print).with("foo=bar baz=42\n")
|
17
17
|
Pliny.log(foo: "bar", baz: 42)
|
18
18
|
end
|
19
19
|
|
@@ -26,26 +26,26 @@ describe Pliny::Log do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "supports blocks to log stages and elapsed" do
|
29
|
-
|
30
|
-
|
29
|
+
expect(@io).to receive(:print).with("foo=bar at=start\n")
|
30
|
+
expect(@io).to receive(:print).with("foo=bar at=finish elapsed=0.000\n")
|
31
31
|
Pliny.log(foo: "bar") do
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
it "merges default context" do
|
36
36
|
Pliny.default_context = { app: "pliny" }
|
37
|
-
|
37
|
+
expect(@io).to receive(:print).with("app=pliny foo=bar\n")
|
38
38
|
Pliny.log(foo: "bar")
|
39
39
|
end
|
40
40
|
|
41
41
|
it "merges context from RequestStore" do
|
42
42
|
Pliny::RequestStore.store[:log_context] = { app: "pliny" }
|
43
|
-
|
43
|
+
expect(@io).to receive(:print).with("app=pliny foo=bar\n")
|
44
44
|
Pliny.log(foo: "bar")
|
45
45
|
end
|
46
46
|
|
47
47
|
it "supports a context" do
|
48
|
-
|
48
|
+
expect(@io).to receive(:print).with("app=pliny foo=bar\n")
|
49
49
|
Pliny.context(app: "pliny") do
|
50
50
|
Pliny.log(foo: "bar")
|
51
51
|
end
|
@@ -53,14 +53,14 @@ describe Pliny::Log do
|
|
53
53
|
|
54
54
|
it "local context does not overwrite default context" do
|
55
55
|
Pliny.default_context = { app: "pliny" }
|
56
|
-
|
56
|
+
expect(@io).to receive(:print).with("app=not_pliny foo=bar\n")
|
57
57
|
Pliny.log(app: 'not_pliny', foo: "bar")
|
58
58
|
assert Pliny.default_context[:app] == "pliny"
|
59
59
|
end
|
60
60
|
|
61
61
|
it "local context does not overwrite request context" do
|
62
62
|
Pliny::RequestStore.store[:log_context] = { app: "pliny" }
|
63
|
-
|
63
|
+
expect(@io).to receive(:print).with("app=not_pliny foo=bar\n")
|
64
64
|
Pliny.context(app: "not_pliny") do
|
65
65
|
Pliny.log(foo: "bar")
|
66
66
|
end
|
@@ -69,7 +69,7 @@ describe Pliny::Log do
|
|
69
69
|
|
70
70
|
it "local context does not propagate outside" do
|
71
71
|
Pliny::RequestStore.store[:log_context] = { app: "pliny" }
|
72
|
-
|
72
|
+
expect(@io).to receive(:print).with("app=pliny foo=bar\n")
|
73
73
|
Pliny.context(app: "not_pliny", test: 123) do
|
74
74
|
end
|
75
75
|
Pliny.log(foo: "bar")
|
@@ -78,7 +78,7 @@ describe Pliny::Log do
|
|
78
78
|
it "logs exceptions" do
|
79
79
|
Pliny::RequestStore.store[:log_context] = { app: "pliny" }
|
80
80
|
e = RuntimeError.new
|
81
|
-
|
81
|
+
expect(@io).to receive(:print).with("app=pliny exception class=RuntimeError message=RuntimeError exception_id=#{e.object_id}\n")
|
82
82
|
Pliny.log_exception(e)
|
83
83
|
end
|
84
84
|
end
|
@@ -23,13 +23,13 @@ describe Pliny::Middleware::Instruments do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "performs logging" do
|
26
|
-
|
26
|
+
expect(Pliny).to receive(:log).with(hash_including(
|
27
27
|
instrumentation: true,
|
28
28
|
at: "start",
|
29
29
|
method: "GET",
|
30
30
|
path: "/apps/123",
|
31
31
|
))
|
32
|
-
|
32
|
+
expect(Pliny).to receive(:log).with(hash_including(
|
33
33
|
instrumentation: true,
|
34
34
|
at: "finish",
|
35
35
|
method: "GET",
|
@@ -41,8 +41,8 @@ describe Pliny::Middleware::Instruments do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "respects Pliny error status codes" do
|
44
|
-
|
45
|
-
|
44
|
+
expect(Pliny).to receive(:log)
|
45
|
+
expect(Pliny).to receive(:log).with(hash_including(
|
46
46
|
status: 404
|
47
47
|
))
|
48
48
|
get "/error"
|
@@ -14,12 +14,12 @@ describe Pliny::Middleware::RequestStore do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "clears the store" do
|
17
|
-
|
17
|
+
expect(Pliny::RequestStore).to receive(:clear!)
|
18
18
|
get "/"
|
19
19
|
end
|
20
20
|
|
21
21
|
it "seeds the store" do
|
22
|
-
|
22
|
+
expect(Pliny::RequestStore).to receive(:seed)
|
23
23
|
get "/"
|
24
24
|
end
|
25
25
|
end
|
@@ -28,7 +28,7 @@ describe Pliny::Middleware::RescueErrors do
|
|
28
28
|
|
29
29
|
it "intercepts exceptions and renders" do
|
30
30
|
@app = new_rack_app
|
31
|
-
|
31
|
+
expect(Pliny::ErrorReporter).to receive(:notify)
|
32
32
|
get "/"
|
33
33
|
assert_equal 500, last_response.status
|
34
34
|
error_json = MultiJson.decode(last_response.body)
|
data/spec/rollbar_logger_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pliny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandur Leach
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -191,26 +191,6 @@ dependencies:
|
|
191
191
|
- - ">="
|
192
192
|
- !ruby/object:Gem::Version
|
193
193
|
version: 0.6.2
|
194
|
-
- !ruby/object:Gem::Dependency
|
195
|
-
name: rr
|
196
|
-
requirement: !ruby/object:Gem::Requirement
|
197
|
-
requirements:
|
198
|
-
- - "~>"
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
version: '1.1'
|
201
|
-
- - ">="
|
202
|
-
- !ruby/object:Gem::Version
|
203
|
-
version: 1.1.2
|
204
|
-
type: :development
|
205
|
-
prerelease: false
|
206
|
-
version_requirements: !ruby/object:Gem::Requirement
|
207
|
-
requirements:
|
208
|
-
- - "~>"
|
209
|
-
- !ruby/object:Gem::Version
|
210
|
-
version: '1.1'
|
211
|
-
- - ">="
|
212
|
-
- !ruby/object:Gem::Version
|
213
|
-
version: 1.1.2
|
214
194
|
- !ruby/object:Gem::Dependency
|
215
195
|
name: rspec
|
216
196
|
requirement: !ruby/object:Gem::Requirement
|