vcr 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +62 -0
- data/README.md +224 -0
- data/Rakefile +12 -5
- data/VERSION +1 -1
- data/benchmarks/http_stubbing_libraries.rb +59 -0
- data/features/fixtures/vcr_cassettes/1.8.6/cucumber_tags/replay_cassette1.yml +25 -25
- data/features/fixtures/vcr_cassettes/1.8.6/cucumber_tags/replay_cassette2.yml +32 -30
- data/features/fixtures/vcr_cassettes/1.8.6/cucumber_tags/replay_cassette3.yml +40 -40
- data/features/fixtures/vcr_cassettes/1.8.6/nested_replay_cassette.yml +16 -15
- data/features/fixtures/vcr_cassettes/1.8.6/not_the_real_response.yml +25 -25
- data/features/fixtures/vcr_cassettes/1.8.7/cucumber_tags/replay_cassette1.yml +23 -23
- data/features/fixtures/vcr_cassettes/1.8.7/cucumber_tags/replay_cassette2.yml +24 -22
- data/features/fixtures/vcr_cassettes/1.8.7/cucumber_tags/replay_cassette3.yml +36 -36
- data/features/fixtures/vcr_cassettes/1.8.7/nested_replay_cassette.yml +12 -11
- data/features/fixtures/vcr_cassettes/1.8.7/not_the_real_response.yml +23 -23
- data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/replay_cassette1.yml +24 -24
- data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/replay_cassette2.yml +26 -24
- data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/replay_cassette3.yml +38 -38
- data/features/fixtures/vcr_cassettes/1.9.1/nested_replay_cassette.yml +13 -12
- data/features/fixtures/vcr_cassettes/1.9.1/not_the_real_response.yml +24 -24
- data/features/record_response.feature +2 -2
- data/features/replay_recorded_response.feature +1 -1
- data/features/step_definitions/vcr_steps.rb +8 -8
- data/features/support/env.rb +6 -0
- data/lib/vcr.rb +16 -3
- data/lib/vcr/cassette.rb +49 -46
- data/lib/vcr/config.rb +8 -0
- data/lib/vcr/extensions/fake_web.rb +12 -26
- data/lib/vcr/extensions/net_http.rb +9 -26
- data/lib/vcr/http_stubbing_adapters/base.rb +34 -0
- data/lib/vcr/http_stubbing_adapters/fakeweb.rb +75 -0
- data/lib/vcr/http_stubbing_adapters/webmock.rb +80 -0
- data/lib/vcr/structs.rb +44 -0
- data/lib/vcr/task_runner.rb +47 -0
- data/lib/vcr/tasks/vcr.rake +9 -0
- data/spec/cassette_spec.rb +70 -71
- data/spec/config_spec.rb +27 -0
- data/spec/extensions/net_http_spec.rb +21 -17
- data/spec/fixtures/1.8.6/0_3_1_cassette.yml +29 -0
- data/spec/fixtures/1.8.6/cassette_spec/example.yml +110 -108
- data/spec/fixtures/1.8.6/example_net_http.yml +14 -0
- data/spec/fixtures/1.8.6/example_net_http_request.yml +12 -0
- data/spec/fixtures/1.8.6/example_net_http_response.yml +25 -0
- data/spec/fixtures/1.8.6/fake_example.com_responses.yml +90 -0
- data/spec/fixtures/1.8.7/0_3_1_cassette.yml +29 -0
- data/spec/fixtures/1.8.7/cassette_spec/example.yml +110 -108
- data/spec/fixtures/1.8.7/example_net_http.yml +14 -0
- data/spec/fixtures/1.8.7/example_net_http_request.yml +12 -0
- data/spec/fixtures/1.8.7/example_net_http_response.yml +25 -0
- data/spec/fixtures/1.8.7/fake_example.com_responses.yml +90 -0
- data/spec/fixtures/1.9.1/0_3_1_cassette.yml +29 -0
- data/spec/fixtures/1.9.1/cassette_spec/example.yml +62 -59
- data/spec/fixtures/1.9.1/example_net_http.yml +14 -0
- data/spec/fixtures/1.9.1/example_net_http_request.yml +12 -0
- data/spec/fixtures/1.9.1/example_net_http_response.yml +25 -0
- data/spec/fixtures/1.9.1/fake_example.com_responses.yml +90 -0
- data/spec/http_stubbing_adapters/fakeweb_spec.rb +24 -0
- data/spec/http_stubbing_adapters/webmock_spec.rb +23 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/structs_spec.rb +95 -0
- data/spec/support/http_stubbing_adapter.rb +113 -0
- data/spec/task_runner_spec.rb +59 -0
- data/spec/vcr_spec.rb +37 -0
- data/vcr.gemspec +45 -15
- metadata +67 -26
- data/History.rdoc +0 -31
- data/README.rdoc +0 -222
- data/lib/vcr/recorded_response.rb +0 -4
- data/spec/extensions/fake_web_spec.rb +0 -63
- data/spec/recorded_response_spec.rb +0 -25
@@ -0,0 +1,14 @@
|
|
1
|
+
--- !ruby/object:Net::HTTP
|
2
|
+
address: example.com
|
3
|
+
close_on_empty_response: false
|
4
|
+
curr_http_version: "1.1"
|
5
|
+
debug_output:
|
6
|
+
newimpl: true
|
7
|
+
open_timeout:
|
8
|
+
port: 80
|
9
|
+
read_timeout: 60
|
10
|
+
seems_1_0_server: false
|
11
|
+
socket:
|
12
|
+
ssl_context:
|
13
|
+
started: true
|
14
|
+
use_ssl: false
|
@@ -0,0 +1,25 @@
|
|
1
|
+
--- !ruby/object:Net::HTTPOK
|
2
|
+
body: The response from example.com
|
3
|
+
body_exist: true
|
4
|
+
code: "200"
|
5
|
+
header:
|
6
|
+
last-modified:
|
7
|
+
- Tue, 15 Nov 2005 13:24:10 GMT
|
8
|
+
connection:
|
9
|
+
- close
|
10
|
+
date:
|
11
|
+
- Wed, 31 Mar 2010 02:43:26 GMT
|
12
|
+
content-type:
|
13
|
+
- text/html; charset=UTF-8
|
14
|
+
etag:
|
15
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
16
|
+
server:
|
17
|
+
- Apache/2.2.3 (CentOS)
|
18
|
+
content-length:
|
19
|
+
- "438"
|
20
|
+
accept-ranges:
|
21
|
+
- bytes
|
22
|
+
http_version: "1.1"
|
23
|
+
message: OK
|
24
|
+
read: true
|
25
|
+
socket:
|
@@ -0,0 +1,90 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://example.com:80/
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 200
|
11
|
+
message: OK
|
12
|
+
headers:
|
13
|
+
etag:
|
14
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
15
|
+
last-modified:
|
16
|
+
- Tue, 15 Nov 2005 13:24:10 GMT
|
17
|
+
content-type:
|
18
|
+
- text/html; charset=UTF-8
|
19
|
+
connection:
|
20
|
+
- close
|
21
|
+
server:
|
22
|
+
- Apache/2.2.3 (CentOS)
|
23
|
+
date:
|
24
|
+
- Wed, 31 Mar 2010 02:43:26 GMT
|
25
|
+
content-length:
|
26
|
+
- "438"
|
27
|
+
accept-ranges:
|
28
|
+
- bytes
|
29
|
+
body: example.com post response with id=7
|
30
|
+
http_version: "1.1"
|
31
|
+
- !ruby/struct:VCR::HTTPInteraction
|
32
|
+
request: !ruby/struct:VCR::Request
|
33
|
+
method: :get
|
34
|
+
uri: http://example.com:80/foo
|
35
|
+
body:
|
36
|
+
headers:
|
37
|
+
response: !ruby/struct:VCR::Response
|
38
|
+
status: !ruby/struct:VCR::ResponseStatus
|
39
|
+
code: 200
|
40
|
+
message: OK
|
41
|
+
headers:
|
42
|
+
etag:
|
43
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
44
|
+
last-modified:
|
45
|
+
- Tue, 15 Nov 2005 13:24:10 GMT
|
46
|
+
connection:
|
47
|
+
- Keep-Alive
|
48
|
+
content-type:
|
49
|
+
- text/html; charset=UTF-8
|
50
|
+
date:
|
51
|
+
- Wed, 31 Mar 2010 02:43:23 GMT
|
52
|
+
server:
|
53
|
+
- Apache/2.2.3 (CentOS)
|
54
|
+
content-length:
|
55
|
+
- "438"
|
56
|
+
age:
|
57
|
+
- "3285"
|
58
|
+
accept-ranges:
|
59
|
+
- bytes
|
60
|
+
body: example.com get response with path=foo
|
61
|
+
http_version: "1.1"
|
62
|
+
- !ruby/struct:VCR::HTTPInteraction
|
63
|
+
request: !ruby/struct:VCR::Request
|
64
|
+
method: :post
|
65
|
+
uri: http://example.com:80/
|
66
|
+
body:
|
67
|
+
headers:
|
68
|
+
response: !ruby/struct:VCR::Response
|
69
|
+
status: !ruby/struct:VCR::ResponseStatus
|
70
|
+
code: 200
|
71
|
+
message: OK
|
72
|
+
headers:
|
73
|
+
etag:
|
74
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
75
|
+
last-modified:
|
76
|
+
- Tue, 15 Nov 2005 13:24:10 GMT
|
77
|
+
content-type:
|
78
|
+
- text/html; charset=UTF-8
|
79
|
+
connection:
|
80
|
+
- close
|
81
|
+
server:
|
82
|
+
- Apache/2.2.3 (CentOS)
|
83
|
+
date:
|
84
|
+
- Wed, 31 Mar 2010 02:43:26 GMT
|
85
|
+
content-length:
|
86
|
+
- "438"
|
87
|
+
accept-ranges:
|
88
|
+
- bytes
|
89
|
+
body: example.com post response with id=3
|
90
|
+
http_version: "1.1"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::RecordedResponse
|
3
|
+
:method: :post
|
4
|
+
:uri: http://example.com:80/
|
5
|
+
:response: !ruby/object:Net::HTTPOK
|
6
|
+
body: The response from example.com
|
7
|
+
body_exist: true
|
8
|
+
code: "200"
|
9
|
+
header:
|
10
|
+
etag:
|
11
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
12
|
+
last-modified:
|
13
|
+
- Tue, 15 Nov 2005 13:24:10 GMT
|
14
|
+
content-type:
|
15
|
+
- text/html; charset=UTF-8
|
16
|
+
connection:
|
17
|
+
- close
|
18
|
+
server:
|
19
|
+
- Apache/2.2.3 (CentOS)
|
20
|
+
date:
|
21
|
+
- Wed, 31 Mar 2010 02:43:26 GMT
|
22
|
+
content-length:
|
23
|
+
- "438"
|
24
|
+
accept-ranges:
|
25
|
+
- bytes
|
26
|
+
http_version: "1.1"
|
27
|
+
message: OK
|
28
|
+
read: true
|
29
|
+
socket:
|
@@ -1,26 +1,15 @@
|
|
1
1
|
---
|
2
|
-
- !ruby/struct:VCR::
|
3
|
-
:
|
4
|
-
|
5
|
-
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
"example.net",
|
14
|
-
or "example.org" into your web browser.</p>
|
15
|
-
<p>These domain names are reserved for use in documentation and are not available
|
16
|
-
for registration. See <a href="http://www.rfc-editor.org/rfc/rfc2606.txt">RFC
|
17
|
-
2606</a>, Section 3.</p>
|
18
|
-
</BODY>
|
19
|
-
</HTML>
|
20
|
-
|
21
|
-
body_exist: true
|
22
|
-
code: "200"
|
23
|
-
header:
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
:request: !ruby/struct:VCR::Request
|
4
|
+
:method: :get
|
5
|
+
:uri: http://example.com:80/
|
6
|
+
:body:
|
7
|
+
:headers:
|
8
|
+
:response: !ruby/struct:VCR::Response
|
9
|
+
:status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
:code: 200
|
11
|
+
:message: OK
|
12
|
+
:headers:
|
24
13
|
server:
|
25
14
|
- Apache/2.2.3 (Red Hat)
|
26
15
|
last-modified:
|
@@ -39,28 +28,33 @@
|
|
39
28
|
- "2090"
|
40
29
|
content-length:
|
41
30
|
- "438"
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
</
|
55
|
-
|
56
|
-
<p>The requested URL /foo was not found on this server.</p>
|
57
|
-
<hr>
|
58
|
-
<address>Apache/2.2.3 (CentOS) Server at example.com Port 80</address>
|
59
|
-
</body></html>
|
31
|
+
:body: |
|
32
|
+
<HTML>
|
33
|
+
<HEAD>
|
34
|
+
<TITLE>Example Web Page</TITLE>
|
35
|
+
</HEAD>
|
36
|
+
<body>
|
37
|
+
<p>You have reached this web page by typing "example.com",
|
38
|
+
"example.net",
|
39
|
+
or "example.org" into your web browser.</p>
|
40
|
+
<p>These domain names are reserved for use in documentation and are not available
|
41
|
+
for registration. See <a href="http://www.rfc-editor.org/rfc/rfc2606.txt">RFC
|
42
|
+
2606</a>, Section 3.</p>
|
43
|
+
</BODY>
|
44
|
+
</HTML>
|
60
45
|
|
61
|
-
|
62
|
-
|
63
|
-
|
46
|
+
:http_version: "1.1"
|
47
|
+
- !ruby/struct:VCR::HTTPInteraction
|
48
|
+
:request: !ruby/struct:VCR::Request
|
49
|
+
:method: :get
|
50
|
+
:uri: http://example.com:80/foo
|
51
|
+
:body:
|
52
|
+
:headers:
|
53
|
+
:response: !ruby/struct:VCR::Response
|
54
|
+
:status: !ruby/struct:VCR::ResponseStatus
|
55
|
+
:code: 404
|
56
|
+
:message: Not Found
|
57
|
+
:headers:
|
64
58
|
date:
|
65
59
|
- Mon, 25 Jan 2010 18:00:32 GMT
|
66
60
|
server:
|
@@ -71,18 +65,29 @@
|
|
71
65
|
- close
|
72
66
|
content-type:
|
73
67
|
- text/html; charset=iso-8859-1
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
68
|
+
:body: |
|
69
|
+
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
|
70
|
+
<html><head>
|
71
|
+
<title>404 Not Found</title>
|
72
|
+
</head><body>
|
73
|
+
<h1>Not Found</h1>
|
74
|
+
<p>The requested URL /foo was not found on this server.</p>
|
75
|
+
<hr>
|
76
|
+
<address>Apache/2.2.3 (CentOS) Server at example.com Port 80</address>
|
77
|
+
</body></html>
|
78
|
+
|
79
|
+
:http_version: "1.1"
|
80
|
+
- !ruby/struct:VCR::HTTPInteraction
|
81
|
+
:request: !ruby/struct:VCR::Request
|
82
|
+
:method: :get
|
83
|
+
:uri: http://example.com:80/
|
84
|
+
:body:
|
85
|
+
:headers:
|
86
|
+
:response: !ruby/struct:VCR::Response
|
87
|
+
:status: !ruby/struct:VCR::ResponseStatus
|
88
|
+
:code: 200
|
89
|
+
:message: OK
|
90
|
+
:headers:
|
86
91
|
server:
|
87
92
|
- Apache/2.2.3 (Red Hat)
|
88
93
|
last-modified:
|
@@ -101,7 +106,5 @@
|
|
101
106
|
- "2090"
|
102
107
|
content-length:
|
103
108
|
- "438"
|
104
|
-
|
105
|
-
|
106
|
-
read: true
|
107
|
-
socket:
|
109
|
+
:body: Another example.com response
|
110
|
+
:http_version: "1.1"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
--- !ruby/object:Net::HTTP
|
2
|
+
address: example.com
|
3
|
+
close_on_empty_response: false
|
4
|
+
curr_http_version: "1.1"
|
5
|
+
debug_output:
|
6
|
+
newimpl: true
|
7
|
+
open_timeout:
|
8
|
+
port: 80
|
9
|
+
read_timeout: 60
|
10
|
+
seems_1_0_server: false
|
11
|
+
socket:
|
12
|
+
ssl_context:
|
13
|
+
started: true
|
14
|
+
use_ssl: false
|
@@ -0,0 +1,25 @@
|
|
1
|
+
--- !ruby/object:Net::HTTPOK
|
2
|
+
body: The response from example.com
|
3
|
+
body_exist: true
|
4
|
+
code: "200"
|
5
|
+
header:
|
6
|
+
last-modified:
|
7
|
+
- Tue, 15 Nov 2005 13:24:10 GMT
|
8
|
+
connection:
|
9
|
+
- close
|
10
|
+
date:
|
11
|
+
- Wed, 31 Mar 2010 02:43:26 GMT
|
12
|
+
content-type:
|
13
|
+
- text/html; charset=UTF-8
|
14
|
+
etag:
|
15
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
16
|
+
server:
|
17
|
+
- Apache/2.2.3 (CentOS)
|
18
|
+
content-length:
|
19
|
+
- "438"
|
20
|
+
accept-ranges:
|
21
|
+
- bytes
|
22
|
+
http_version: "1.1"
|
23
|
+
message: OK
|
24
|
+
read: true
|
25
|
+
socket:
|
@@ -0,0 +1,90 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
:request: !ruby/struct:VCR::Request
|
4
|
+
:method: :post
|
5
|
+
:uri: http://example.com:80/
|
6
|
+
:body:
|
7
|
+
:headers:
|
8
|
+
:response: !ruby/struct:VCR::Response
|
9
|
+
:status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
:code: 200
|
11
|
+
:message: OK
|
12
|
+
:headers:
|
13
|
+
etag:
|
14
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
15
|
+
last-modified:
|
16
|
+
- Tue, 15 Nov 2005 13:24:10 GMT
|
17
|
+
content-type:
|
18
|
+
- text/html; charset=UTF-8
|
19
|
+
connection:
|
20
|
+
- close
|
21
|
+
server:
|
22
|
+
- Apache/2.2.3 (CentOS)
|
23
|
+
date:
|
24
|
+
- Wed, 31 Mar 2010 02:43:26 GMT
|
25
|
+
content-length:
|
26
|
+
- "438"
|
27
|
+
accept-ranges:
|
28
|
+
- bytes
|
29
|
+
:body: example.com post response with id=7
|
30
|
+
:http_version: "1.1"
|
31
|
+
- !ruby/struct:VCR::HTTPInteraction
|
32
|
+
:request: !ruby/struct:VCR::Request
|
33
|
+
:method: :get
|
34
|
+
:uri: http://example.com:80/foo
|
35
|
+
:body:
|
36
|
+
:headers:
|
37
|
+
:response: !ruby/struct:VCR::Response
|
38
|
+
:status: !ruby/struct:VCR::ResponseStatus
|
39
|
+
:code: 200
|
40
|
+
:message: OK
|
41
|
+
:headers:
|
42
|
+
etag:
|
43
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
44
|
+
last-modified:
|
45
|
+
- Tue, 15 Nov 2005 13:24:10 GMT
|
46
|
+
connection:
|
47
|
+
- Keep-Alive
|
48
|
+
content-type:
|
49
|
+
- text/html; charset=UTF-8
|
50
|
+
date:
|
51
|
+
- Wed, 31 Mar 2010 02:43:23 GMT
|
52
|
+
server:
|
53
|
+
- Apache/2.2.3 (CentOS)
|
54
|
+
content-length:
|
55
|
+
- "438"
|
56
|
+
age:
|
57
|
+
- "3285"
|
58
|
+
accept-ranges:
|
59
|
+
- bytes
|
60
|
+
:body: example.com get response with path=foo
|
61
|
+
:http_version: "1.1"
|
62
|
+
- !ruby/struct:VCR::HTTPInteraction
|
63
|
+
:request: !ruby/struct:VCR::Request
|
64
|
+
:method: :post
|
65
|
+
:uri: http://example.com:80/
|
66
|
+
:body:
|
67
|
+
:headers:
|
68
|
+
:response: !ruby/struct:VCR::Response
|
69
|
+
:status: !ruby/struct:VCR::ResponseStatus
|
70
|
+
:code: 200
|
71
|
+
:message: OK
|
72
|
+
:headers:
|
73
|
+
etag:
|
74
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
75
|
+
last-modified:
|
76
|
+
- Tue, 15 Nov 2005 13:24:10 GMT
|
77
|
+
content-type:
|
78
|
+
- text/html; charset=UTF-8
|
79
|
+
connection:
|
80
|
+
- close
|
81
|
+
server:
|
82
|
+
- Apache/2.2.3 (CentOS)
|
83
|
+
date:
|
84
|
+
- Wed, 31 Mar 2010 02:43:26 GMT
|
85
|
+
content-length:
|
86
|
+
- "438"
|
87
|
+
accept-ranges:
|
88
|
+
- bytes
|
89
|
+
:body: example.com post response with id=3
|
90
|
+
:http_version: "1.1"
|