heroku-request-id 0.0.8 → 0.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82a2faf66bd7a74a8491db5c8c829b73b703fdde
4
- data.tar.gz: 35486a3a476614e2944d2cb6dbc10603dccc4586
3
+ metadata.gz: bddaa4928013e2ba7ac9a3268104a76c4d008290
4
+ data.tar.gz: c28557afe1abc854473a128711e670d251307038
5
5
  SHA512:
6
- metadata.gz: 285cfc49dfe52fe0d60bd8dccb478c925c86e0a93627db65648cf8fef5cc72159d2ac75ca571ca95988d6a647984a37c04d390d8b08d76ecdc9477e4c4aa6a43
7
- data.tar.gz: bf01e0150a1d42f4e36043ad3f09c52cb62451a2491e5b4e81dfa93e59c4197d12ebb5b28f8a70c48e3690bf0770431eb6ce16b660222ed393c3b9c367739e3d
6
+ metadata.gz: 73943012ca4416407e531f5d09bea0b1f96583a80bc2a96e370414e5ac9621c8113f3a01c496d58ba2b7043ae394922b4e4d97f0528e596dccafbddb9d7a1cc0
7
+ data.tar.gz: 3375678af04df501dcbd5a40a12b5ce56658c7ffaed825ba8f784929cbd841262bc8b3b10e282df25fb61db13b7b05de0f3d570113ce3f58cdb0640e72441e0d
@@ -55,7 +55,7 @@ module HerokuRequestId
55
55
  end
56
56
 
57
57
  def build_msg
58
- elapsed = @env['X-Runtime']
58
+ elapsed = @headers['X-Runtime']
59
59
  msg = %[Heroku request id : #{@request_id}]
60
60
  if elapsed && elapsed.strip != ""
61
61
  msg += %[ - Elapsed time (from Rack::Runtime) : #{elapsed}]
@@ -1,3 +1,3 @@
1
1
  module HerokuRequestId
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -8,35 +8,39 @@ describe HerokuRequestId::Middleware do
8
8
  lambda { |env| [200, {'Content-Type' => 'text/html'}, ['<body>All good!</body>']] }
9
9
  end
10
10
 
11
+ let(:inner_app_with_rack_runtime) do
12
+ lambda { |env| [200, {'Content-Type' => 'text/html','X-Runtime' => '42'}, ['<body>All good!</body>']] }
13
+ end
14
+
11
15
  let(:app) { HerokuRequestId::Middleware.new(inner_app) }
12
16
 
13
- let(:request_without_rack_runtime)do
17
+ let(:request)do
14
18
  capture_stdout{ get("/", {}, {"HTTP_HEROKU_REQUEST_ID" => "the_id_string"}) }
15
19
  end
16
20
 
17
- let(:request_with_rack_runtime)do
18
- capture_stdout{ get("/", {}, {"HTTP_HEROKU_REQUEST_ID" => "the_id_string","X-Runtime" => "42"}) }
19
- end
20
-
21
21
  it "prints the request id to stdout by default" do
22
- output = request_without_rack_runtime
22
+ output = request
23
23
  output.should match("Heroku request id")
24
24
  output.should match("the_id_string")
25
25
  end
26
26
 
27
27
  it "Does not include runtime information if the 'X-Runtime' header is not present" do
28
- output = request_without_rack_runtime
28
+ output = request
29
29
  output.should match("Runtime info not available")
30
30
  end
31
31
 
32
- it "Does include runtime information if the 'X-Runtime' header is present" do
33
- output = request_with_rack_runtime
34
- output.should match("Elapsed time")
32
+ describe "with Rack::Runtime" do
33
+ let(:app) { HerokuRequestId::Middleware.new(inner_app_with_rack_runtime) }
34
+ it "Does include runtime information if the 'X-Runtime' header is present" do
35
+ output = request
36
+ output.should match("Elapsed time")
37
+ end
35
38
  end
39
+
36
40
 
37
41
  it "does not print the request id to stdout if log_line == false" do
38
42
  HerokuRequestId::Middleware.log_line = false
39
- output = request_without_rack_runtime
43
+ output = request
40
44
  output.should_not match("heroku-request-id")
41
45
  output.should_not match("the_id_string")
42
46
  # reset html_comment so that random test order works
@@ -44,14 +48,14 @@ describe HerokuRequestId::Middleware do
44
48
  end
45
49
 
46
50
  it "does not add a comment with the Heroku request id by default" do
47
- request_without_rack_runtime
51
+ request
48
52
  last_response.body.should_not match("Heroku request id")
49
53
  last_response.body.should_not match("the_id_string")
50
54
  end
51
55
 
52
56
  it "does add a comment with the Heroku request id if html_comment == true" do
53
57
  HerokuRequestId::Middleware.html_comment = true
54
- request_without_rack_runtime
58
+ request
55
59
  last_response.body.should match("Heroku request id")
56
60
  last_response.body.should match("the_id_string")
57
61
  # reset html_comment so that random test order works
@@ -59,7 +63,7 @@ describe HerokuRequestId::Middleware do
59
63
  end
60
64
 
61
65
  it "makes no change to response status" do
62
- request_without_rack_runtime
66
+ request
63
67
  last_response.should be_ok
64
68
  end
65
69
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-request-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Green