rspec-performance 0.0.1 → 0.0.2
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.
@@ -11,6 +11,7 @@ module Spec
|
|
11
11
|
|
12
12
|
def initialize(base_uri)
|
13
13
|
@base_uri = base_uri
|
14
|
+
@headers = {}
|
14
15
|
@cookies = {}
|
15
16
|
@recording = true
|
16
17
|
end
|
@@ -33,7 +34,7 @@ module Spec
|
|
33
34
|
end
|
34
35
|
|
35
36
|
http = Net::HTTP.start(uri.host, uri.port)
|
36
|
-
response = http.get(uri.request_uri,
|
37
|
+
response = http.get(uri.request_uri, headers)
|
37
38
|
http.finish
|
38
39
|
|
39
40
|
create_http_client_response(response)
|
@@ -64,10 +65,7 @@ module Spec
|
|
64
65
|
end
|
65
66
|
|
66
67
|
def headers
|
67
|
-
@
|
68
|
-
acc["Cookie"] = cookie.to_s
|
69
|
-
acc
|
70
|
-
end
|
68
|
+
@headers.merge("Cookie" => browser_cookies)
|
71
69
|
end
|
72
70
|
|
73
71
|
def browser_cookies
|
@@ -47,6 +47,10 @@ class IntegrationServer
|
|
47
47
|
map "/cookie_echo" do
|
48
48
|
run CookieEchoAdapter.new
|
49
49
|
end
|
50
|
+
|
51
|
+
map "/host_echo" do
|
52
|
+
run HostEchoAdapter.new
|
53
|
+
end
|
50
54
|
end
|
51
55
|
end
|
52
56
|
sleep 0.010 unless @server && @server.running?
|
@@ -78,4 +82,10 @@ class IntegrationServer
|
|
78
82
|
[200, { "Set-Cookie" => cookie_string }, ["echo"]]
|
79
83
|
end
|
80
84
|
end
|
85
|
+
|
86
|
+
class HostEchoAdapter
|
87
|
+
def call(env)
|
88
|
+
[200, { 'Content-Type' => 'text/html'}, [env["HTTP_HOST"]]]
|
89
|
+
end
|
90
|
+
end
|
81
91
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../spec_helper"
|
2
|
+
|
3
|
+
describe IntegrationServer do
|
4
|
+
describe "HostEchoAdapter" do
|
5
|
+
describe "when HTTP_HOST is set by the client" do
|
6
|
+
it "echos the client specified value back" do
|
7
|
+
uri = URI.parse("http://localhost:8888/host_echo")
|
8
|
+
http = Net::HTTP.start(uri.host, uri.port)
|
9
|
+
response = http.get(uri.request_uri, { "Host" => "x.y.z.com" })
|
10
|
+
http.finish
|
11
|
+
|
12
|
+
response.body.should include("x.y.z.com")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "when HTTP_HOST is not set" do
|
17
|
+
it "defaults to the machine name"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Remeika
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- lib/spec/performance/example/performance_execution_builder.rb
|
33
33
|
- lib/spec/performance/version.rb
|
34
34
|
- spec/helpers/integration_server.rb
|
35
|
+
- spec/helpers/integration_server_spec.rb
|
35
36
|
- spec/lib/spec/performance/client/http_client_spec.rb
|
36
37
|
- spec/lib/spec/performance/configuration_spec.rb
|
37
38
|
- spec/lib/spec/performance/example/performance_example_group_methods_spec.rb
|