sitehub 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sitehub/middleware/transaction_id.rb +2 -1
- data/lib/sitehub/version.rb +1 -1
- data/spec/sitehub/middleware/transaction_id_spec.rb +8 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04363e00e3336d8455b4cb2c9d4eb4fc9740b8b5
|
4
|
+
data.tar.gz: 6016da732dd7cdb35e7dbe0a1d74697f98dc9557
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96eaea637b18d9e272b526d664a9d5c748d910a8c59de339b2f091df2a3e693f3cbf5363cdf0f62f1c8831f5449fb01c1f647c66b0ecd63bd9b181db0b025ab4
|
7
|
+
data.tar.gz: 5165e6d91e40ac2945fd881efe73d69f4addd303bed5d35c87bee949343fd05f3231065f2f88a2bc25cef0154a0af548705b5665e39b9d38500a5cc5a15e66b4
|
data/Gemfile.lock
CHANGED
data/lib/sitehub/version.rb
CHANGED
@@ -3,26 +3,29 @@ require 'sitehub/middleware/transaction_id'
|
|
3
3
|
class SiteHub
|
4
4
|
module Middleware
|
5
5
|
describe TransactionId do
|
6
|
-
let(:transaction_id) { Constants::
|
6
|
+
let(:transaction_id) { Constants::HttpHeaderKeys::TRANSACTION_ID }
|
7
7
|
subject do
|
8
8
|
described_class.new(proc {})
|
9
9
|
end
|
10
|
+
|
11
|
+
let(:request) { Request.new(env: {}) }
|
12
|
+
let(:env) { { REQUEST => request } }
|
13
|
+
|
10
14
|
it 'adds a unique identifier to the request' do
|
11
15
|
uuid = UUID.generate(:compact)
|
12
16
|
expect(UUID).to receive(:generate).with(:compact).and_return(uuid)
|
13
|
-
env = {}
|
14
17
|
subject.call(env)
|
15
18
|
|
16
|
-
expect(
|
19
|
+
expect(request.headers[transaction_id]).to eq(uuid)
|
17
20
|
end
|
18
21
|
|
19
22
|
context 'transaction id header already exists' do
|
20
23
|
it 'leaves it intact' do
|
21
24
|
expect(UUID).to_not receive(:generate)
|
22
|
-
|
25
|
+
request.headers[transaction_id] = :existing_id
|
23
26
|
subject.call(env)
|
24
27
|
|
25
|
-
expect(
|
28
|
+
expect(request.headers[transaction_id]).to eq(:existing_id)
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|