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
@@ -1,45 +1,47 @@
|
|
1
1
|
---
|
2
|
-
- !ruby/struct:VCR::
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: http://example.com:80/before_nested
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 404
|
11
|
+
message: Not Found
|
12
|
+
headers:
|
12
13
|
connection:
|
13
14
|
- close
|
14
|
-
|
15
|
-
-
|
15
|
+
content-type:
|
16
|
+
- text/html; charset=iso-8859-1
|
16
17
|
date:
|
17
18
|
- Thu, 25 Feb 2010 15:23:39 GMT
|
19
|
+
server:
|
20
|
+
- Apache/2.2.3 (CentOS)
|
18
21
|
content-length:
|
19
22
|
- "287"
|
23
|
+
body: The before_nested response
|
20
24
|
http_version: "1.1"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
response: !ruby/
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
content-type:
|
33
|
-
- text/html; charset=iso-8859-1
|
25
|
+
- !ruby/struct:VCR::HTTPInteraction
|
26
|
+
request: !ruby/struct:VCR::Request
|
27
|
+
method: :get
|
28
|
+
uri: http://example.com:80/after_nested
|
29
|
+
body:
|
30
|
+
headers:
|
31
|
+
response: !ruby/struct:VCR::Response
|
32
|
+
status: !ruby/struct:VCR::ResponseStatus
|
33
|
+
code: 404
|
34
|
+
message: Not Found
|
35
|
+
headers:
|
34
36
|
connection:
|
35
37
|
- close
|
36
|
-
|
37
|
-
-
|
38
|
+
content-type:
|
39
|
+
- text/html; charset=iso-8859-1
|
38
40
|
date:
|
39
41
|
- Thu, 25 Feb 2010 15:23:39 GMT
|
42
|
+
server:
|
43
|
+
- Apache/2.2.3 (CentOS)
|
40
44
|
content-length:
|
41
45
|
- "286"
|
46
|
+
body: The after_nested response
|
42
47
|
http_version: "1.1"
|
43
|
-
message: Not Found
|
44
|
-
read: true
|
45
|
-
socket:
|
@@ -1,30 +1,21 @@
|
|
1
1
|
---
|
2
|
-
- !ruby/struct:VCR::
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
This is not the real response from example.com
|
14
|
-
</p>
|
15
|
-
</BODY>
|
16
|
-
</HTML>
|
17
|
-
|
18
|
-
|
19
|
-
body_exist: true
|
20
|
-
code: "200"
|
21
|
-
header:
|
22
|
-
etag:
|
23
|
-
- "\"24ec5-1b6-4059a80bfd280\""
|
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
|
last-modified:
|
25
14
|
- Tue, 15 Nov 2005 13:24:10 GMT
|
26
15
|
connection:
|
27
16
|
- Keep-Alive
|
17
|
+
etag:
|
18
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
28
19
|
content-type:
|
29
20
|
- text/html; charset=UTF-8
|
30
21
|
date:
|
@@ -37,14 +28,6 @@
|
|
37
28
|
- "2643"
|
38
29
|
accept-ranges:
|
39
30
|
- bytes
|
40
|
-
http_version: "1.1"
|
41
|
-
message: OK
|
42
|
-
read: true
|
43
|
-
socket:
|
44
|
-
- !ruby/struct:VCR::RecordedResponse
|
45
|
-
method: :get
|
46
|
-
uri: http://example.com:80/
|
47
|
-
response: !ruby/object:Net::HTTPOK
|
48
31
|
body: |
|
49
32
|
<HTML>
|
50
33
|
<HEAD>
|
@@ -52,21 +35,29 @@
|
|
52
35
|
</HEAD>
|
53
36
|
<body>
|
54
37
|
<p>
|
55
|
-
This is
|
38
|
+
This is not the real response from example.com
|
56
39
|
</p>
|
57
40
|
</BODY>
|
58
41
|
</HTML>
|
59
|
-
|
60
42
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
43
|
+
http_version: "1.1"
|
44
|
+
- !ruby/struct:VCR::HTTPInteraction
|
45
|
+
request: !ruby/struct:VCR::Request
|
46
|
+
method: :get
|
47
|
+
uri: http://example.com:80/
|
48
|
+
body:
|
49
|
+
headers:
|
50
|
+
response: !ruby/struct:VCR::Response
|
51
|
+
status: !ruby/struct:VCR::ResponseStatus
|
52
|
+
code: 200
|
53
|
+
message: OK
|
54
|
+
headers:
|
66
55
|
last-modified:
|
67
56
|
- Tue, 15 Nov 2005 13:24:10 GMT
|
68
57
|
connection:
|
69
58
|
- Keep-Alive
|
59
|
+
etag:
|
60
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
70
61
|
content-type:
|
71
62
|
- text/html; charset=UTF-8
|
72
63
|
date:
|
@@ -79,7 +70,16 @@
|
|
79
70
|
- "2643"
|
80
71
|
accept-ranges:
|
81
72
|
- bytes
|
73
|
+
body: |
|
74
|
+
<HTML>
|
75
|
+
<HEAD>
|
76
|
+
<TITLE>Example Web Page</TITLE>
|
77
|
+
</HEAD>
|
78
|
+
<body>
|
79
|
+
<p>
|
80
|
+
This is another fake response from example.com
|
81
|
+
</p>
|
82
|
+
</BODY>
|
83
|
+
</HTML>
|
84
|
+
|
82
85
|
http_version: "1.1"
|
83
|
-
message: OK
|
84
|
-
read: true
|
85
|
-
socket:
|
@@ -1,23 +1,24 @@
|
|
1
1
|
---
|
2
|
-
- !ruby/struct:VCR::
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: http://example.com:80/nested
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 404
|
11
|
+
message: Not Found
|
12
|
+
headers:
|
12
13
|
connection:
|
13
14
|
- close
|
14
|
-
|
15
|
-
-
|
15
|
+
content-type:
|
16
|
+
- text/html; charset=iso-8859-1
|
16
17
|
date:
|
17
18
|
- Thu, 25 Feb 2010 15:19:40 GMT
|
19
|
+
server:
|
20
|
+
- Apache/2.2.3 (CentOS)
|
18
21
|
content-length:
|
19
22
|
- "280"
|
23
|
+
body: The nested response
|
20
24
|
http_version: "1.1"
|
21
|
-
message: Not Found
|
22
|
-
read: true
|
23
|
-
socket:
|
@@ -1,30 +1,21 @@
|
|
1
1
|
---
|
2
|
-
- !ruby/struct:VCR::
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
This is not the real response from example.com
|
14
|
-
</p>
|
15
|
-
</BODY>
|
16
|
-
</HTML>
|
17
|
-
|
18
|
-
|
19
|
-
body_exist: true
|
20
|
-
code: "200"
|
21
|
-
header:
|
22
|
-
etag:
|
23
|
-
- "\"24ec5-1b6-4059a80bfd280\""
|
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
|
last-modified:
|
25
14
|
- Tue, 15 Nov 2005 13:24:10 GMT
|
26
15
|
connection:
|
27
16
|
- Keep-Alive
|
17
|
+
etag:
|
18
|
+
- "\"24ec5-1b6-4059a80bfd280\""
|
28
19
|
content-type:
|
29
20
|
- text/html; charset=UTF-8
|
30
21
|
date:
|
@@ -37,7 +28,16 @@
|
|
37
28
|
- "2546"
|
38
29
|
accept-ranges:
|
39
30
|
- bytes
|
31
|
+
body: |
|
32
|
+
<HTML>
|
33
|
+
<HEAD>
|
34
|
+
<TITLE>Example Web Page</TITLE>
|
35
|
+
</HEAD>
|
36
|
+
<body>
|
37
|
+
<p>
|
38
|
+
This is not the real response from example.com
|
39
|
+
</p>
|
40
|
+
</BODY>
|
41
|
+
</HTML>
|
42
|
+
|
40
43
|
http_version: "1.1"
|
41
|
-
message: OK
|
42
|
-
read: true
|
43
|
-
socket:
|
@@ -1,24 +1,15 @@
|
|
1
1
|
---
|
2
|
-
- !ruby/struct:VCR::
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
This is not the real response from example.com
|
14
|
-
</p>
|
15
|
-
</BODY>
|
16
|
-
</HTML>
|
17
|
-
|
18
|
-
|
19
|
-
body_exist: true
|
20
|
-
code: "200"
|
21
|
-
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:
|
22
13
|
etag:
|
23
14
|
- "\"24ec5-1b6-4059a80bfd280\""
|
24
15
|
last-modified:
|
@@ -37,7 +28,16 @@
|
|
37
28
|
- "2643"
|
38
29
|
accept-ranges:
|
39
30
|
- bytes
|
31
|
+
body: |
|
32
|
+
<HTML>
|
33
|
+
<HEAD>
|
34
|
+
<TITLE>Example Web Page</TITLE>
|
35
|
+
</HEAD>
|
36
|
+
<body>
|
37
|
+
<p>
|
38
|
+
This is not the real response from example.com
|
39
|
+
</p>
|
40
|
+
</BODY>
|
41
|
+
</HTML>
|
42
|
+
|
40
43
|
http_version: "1.1"
|
41
|
-
message: OK
|
42
|
-
read: true
|
43
|
-
socket:
|
@@ -1,12 +1,15 @@
|
|
1
1
|
---
|
2
|
-
- !ruby/struct:VCR::
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: http://example.com:80/before_nested
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 404
|
11
|
+
message: Not Found
|
12
|
+
headers:
|
10
13
|
content-type:
|
11
14
|
- text/html; charset=iso-8859-1
|
12
15
|
connection:
|
@@ -17,18 +20,19 @@
|
|
17
20
|
- Thu, 25 Feb 2010 15:23:39 GMT
|
18
21
|
content-length:
|
19
22
|
- "287"
|
23
|
+
body: The before_nested response
|
20
24
|
http_version: "1.1"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
response: !ruby/
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
- !ruby/struct:VCR::HTTPInteraction
|
26
|
+
request: !ruby/struct:VCR::Request
|
27
|
+
method: :get
|
28
|
+
uri: http://example.com:80/after_nested
|
29
|
+
body:
|
30
|
+
headers:
|
31
|
+
response: !ruby/struct:VCR::Response
|
32
|
+
status: !ruby/struct:VCR::ResponseStatus
|
33
|
+
code: 404
|
34
|
+
message: Not Found
|
35
|
+
headers:
|
32
36
|
content-type:
|
33
37
|
- text/html; charset=iso-8859-1
|
34
38
|
connection:
|
@@ -39,7 +43,5 @@
|
|
39
43
|
- Thu, 25 Feb 2010 15:23:39 GMT
|
40
44
|
content-length:
|
41
45
|
- "286"
|
46
|
+
body: The after_nested response
|
42
47
|
http_version: "1.1"
|
43
|
-
message: Not Found
|
44
|
-
read: true
|
45
|
-
socket:
|
@@ -1,24 +1,15 @@
|
|
1
1
|
---
|
2
|
-
- !ruby/struct:VCR::
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
This is not the real response from example.com
|
14
|
-
</p>
|
15
|
-
</BODY>
|
16
|
-
</HTML>
|
17
|
-
|
18
|
-
|
19
|
-
body_exist: true
|
20
|
-
code: "200"
|
21
|
-
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:
|
22
13
|
etag:
|
23
14
|
- "\"24ec5-1b6-4059a80bfd280\""
|
24
15
|
last-modified:
|
@@ -37,14 +28,6 @@
|
|
37
28
|
- "2643"
|
38
29
|
accept-ranges:
|
39
30
|
- bytes
|
40
|
-
http_version: "1.1"
|
41
|
-
message: OK
|
42
|
-
read: true
|
43
|
-
socket:
|
44
|
-
- !ruby/struct:VCR::RecordedResponse
|
45
|
-
method: :get
|
46
|
-
uri: http://example.com:80/
|
47
|
-
response: !ruby/object:Net::HTTPOK
|
48
31
|
body: |
|
49
32
|
<HTML>
|
50
33
|
<HEAD>
|
@@ -52,15 +35,23 @@
|
|
52
35
|
</HEAD>
|
53
36
|
<body>
|
54
37
|
<p>
|
55
|
-
This is
|
38
|
+
This is not the real response from example.com
|
56
39
|
</p>
|
57
40
|
</BODY>
|
58
41
|
</HTML>
|
59
|
-
|
60
42
|
|
61
|
-
|
62
|
-
|
63
|
-
|
43
|
+
http_version: "1.1"
|
44
|
+
- !ruby/struct:VCR::HTTPInteraction
|
45
|
+
request: !ruby/struct:VCR::Request
|
46
|
+
method: :get
|
47
|
+
uri: http://example.com:80/
|
48
|
+
body:
|
49
|
+
headers:
|
50
|
+
response: !ruby/struct:VCR::Response
|
51
|
+
status: !ruby/struct:VCR::ResponseStatus
|
52
|
+
code: 200
|
53
|
+
message: OK
|
54
|
+
headers:
|
64
55
|
etag:
|
65
56
|
- "\"24ec5-1b6-4059a80bfd280\""
|
66
57
|
last-modified:
|
@@ -79,7 +70,16 @@
|
|
79
70
|
- "2643"
|
80
71
|
accept-ranges:
|
81
72
|
- bytes
|
73
|
+
body: |
|
74
|
+
<HTML>
|
75
|
+
<HEAD>
|
76
|
+
<TITLE>Example Web Page</TITLE>
|
77
|
+
</HEAD>
|
78
|
+
<body>
|
79
|
+
<p>
|
80
|
+
This is another fake response from example.com
|
81
|
+
</p>
|
82
|
+
</BODY>
|
83
|
+
</HTML>
|
84
|
+
|
82
85
|
http_version: "1.1"
|
83
|
-
message: OK
|
84
|
-
read: true
|
85
|
-
socket:
|