http_stub 0.14.0.rc4 → 0.14.0.rc5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0c96ca88114548b718056ae0fc9fabd49ccfdd5
|
4
|
+
data.tar.gz: 5ab01f22d067613d869ba5709ed4ac69cab80bdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f8095e3f1cf0701e2b9e5158a8874f4532ffd82411c7758d042e5b4f0735365d577ce3601e76bf6119f5aaaada226466597f56a2334a0231eaf7344e773d095
|
7
|
+
data.tar.gz: 1ebbbf072c32a28a2beeb8ab79c6767066f14bd3b83409eac5fa26bc5f8722655fb26019a5e2c4404b8fab670aa4eb5fd1d4c7b8a26b8c145f2fb32a0d127198
|
data/lib/http_stub/version.rb
CHANGED
@@ -1,35 +1,45 @@
|
|
1
1
|
describe HttpStub::Models::RequestHeaderParser do
|
2
2
|
|
3
|
-
let(:
|
3
|
+
let(:non_header_env_elements) do
|
4
4
|
{
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
"SCRIPT_NAME" => "some script",
|
9
|
-
"SERVER_NAME" => "localhost",
|
5
|
+
"rack.version" => [1, 3],
|
6
|
+
"rack.multithreaded" => true,
|
7
|
+
"rack.multiprocess" => false
|
10
8
|
}
|
11
9
|
end
|
12
|
-
let(:env) {
|
10
|
+
let(:env) { non_header_env_elements.merge(header_env_elements) }
|
13
11
|
let(:request) { double("HttpRequest", env: env) }
|
14
12
|
|
15
|
-
describe "
|
16
|
-
|
17
|
-
describe "when the request contains request environment entries prefixed with 'HTTP_'" do
|
13
|
+
describe "::parse" do
|
18
14
|
|
19
|
-
|
15
|
+
describe "when the request contains environment entries in upper case" do
|
20
16
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
let(:header_env_elements) { { "KEY_1" => "value1", "KEY_2" => "value2", "KEY_3" => "value3" } }
|
18
|
+
|
19
|
+
it "returns a hash containing those entries" do
|
20
|
+
expect(HttpStub::Models::RequestHeaderParser.parse(request)).to eql("KEY_1" => "value1",
|
21
|
+
"KEY_2" => "value2",
|
22
|
+
"KEY_3" => "value3")
|
25
23
|
end
|
26
24
|
|
27
25
|
end
|
28
|
-
|
29
|
-
describe "when the request does not contain request environment entries prefixed with 'HTTP_'" do
|
30
26
|
|
31
|
-
|
32
|
-
|
27
|
+
describe "when the request contains environment entries in upper case prefixed with 'HTTP_'" do
|
28
|
+
|
29
|
+
let(:header_env_elements) { { "HTTP_KEY_1" => "value1", "HTTP_KEY_2" => "value2", "HTTP_KEY_3" => "value3" } }
|
30
|
+
|
31
|
+
it "returns a hash containing those entries with the prefix removed" do
|
32
|
+
expect(HttpStub::Models::RequestHeaderParser.parse(request)).to include("KEY_1" => "value1",
|
33
|
+
"KEY_2" => "value2",
|
34
|
+
"KEY_3" => "value3")
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "when only has environment entries in lower case" do
|
40
|
+
|
41
|
+
let(:header_env_elements) { {} }
|
42
|
+
|
33
43
|
it "returns an empty hash" do
|
34
44
|
expect(HttpStub::Models::RequestHeaderParser.parse(request)).to eql({})
|
35
45
|
end
|