vcr 1.1.0 → 1.1.1

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.
Files changed (84) hide show
  1. data/.document +5 -0
  2. data/.gitignore +27 -0
  3. data/CHANGELOG.md +13 -0
  4. data/Gemfile +24 -0
  5. data/Gemfile.lock +119 -0
  6. data/README.md +3 -6
  7. data/Rakefile +70 -0
  8. data/benchmarks/http_stubbing_libraries.rb +59 -0
  9. data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/regex_cassette.yml +43 -0
  10. data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/replay_cassette1.yml +43 -0
  11. data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/replay_cassette2.yml +63 -0
  12. data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/replay_cassette3.yml +85 -0
  13. data/features/fixtures/vcr_cassettes/1.9.1/erb_cassette.yml +36 -0
  14. data/features/fixtures/vcr_cassettes/1.9.1/match_requests_on.yml +35 -0
  15. data/features/fixtures/vcr_cassettes/1.9.1/nested_replay_cassette.yml +32 -0
  16. data/features/fixtures/vcr_cassettes/1.9.1/not_the_real_response.yml +43 -0
  17. data/features/fixtures/vcr_cassettes/1.9.1/replay_localhost_cassette.yml +32 -0
  18. data/features/fixtures/vcr_cassettes/not_1.9.1/cucumber_tags/regex_cassette.yml +43 -0
  19. data/features/fixtures/vcr_cassettes/not_1.9.1/cucumber_tags/replay_cassette1.yml +43 -0
  20. data/features/fixtures/vcr_cassettes/not_1.9.1/cucumber_tags/replay_cassette2.yml +47 -0
  21. data/features/fixtures/vcr_cassettes/not_1.9.1/cucumber_tags/replay_cassette3.yml +85 -0
  22. data/features/fixtures/vcr_cassettes/not_1.9.1/erb_cassette.yml +36 -0
  23. data/features/fixtures/vcr_cassettes/not_1.9.1/match_requests_on.yml +35 -0
  24. data/features/fixtures/vcr_cassettes/not_1.9.1/nested_replay_cassette.yml +24 -0
  25. data/features/fixtures/vcr_cassettes/not_1.9.1/not_the_real_response.yml +43 -0
  26. data/features/fixtures/vcr_cassettes/not_1.9.1/replay_localhost_cassette.yml +32 -0
  27. data/features/http_client.feature +16 -0
  28. data/features/net_http.feature +27 -0
  29. data/features/record_response.feature +66 -0
  30. data/features/replay_recorded_response.feature +96 -0
  31. data/features/step_definitions/http_client_steps.rb +7 -0
  32. data/features/step_definitions/net_http_steps.rb +37 -0
  33. data/features/step_definitions/vcr_steps.rb +240 -0
  34. data/features/support/env.rb +104 -0
  35. data/features/webmock.feature +26 -0
  36. data/lib/vcr.rb +2 -2
  37. data/lib/vcr/extensions/net_http.rb +0 -8
  38. data/lib/vcr/http_stubbing_adapters/common.rb +39 -0
  39. data/lib/vcr/http_stubbing_adapters/fakeweb.rb +74 -70
  40. data/lib/vcr/http_stubbing_adapters/webmock.rb +61 -62
  41. data/lib/vcr/version.rb +1 -1
  42. data/spec/cassette_spec.rb +280 -0
  43. data/spec/config_spec.rb +76 -0
  44. data/spec/cucumber_tags_spec.rb +55 -0
  45. data/spec/deprecations_spec.rb +52 -0
  46. data/spec/extensions/net_http_response_spec.rb +85 -0
  47. data/spec/extensions/net_http_spec.rb +77 -0
  48. data/spec/fixtures/1.9.1/0_3_1_cassette.yml +29 -0
  49. data/spec/fixtures/1.9.1/cassette_spec/erb_with_no_vars.yml +32 -0
  50. data/spec/fixtures/1.9.1/cassette_spec/erb_with_vars.yml +32 -0
  51. data/spec/fixtures/1.9.1/cassette_spec/example.yml +110 -0
  52. data/spec/fixtures/1.9.1/cassette_spec/with_localhost_requests.yml +86 -0
  53. data/spec/fixtures/1.9.1/example_net_http.yml +14 -0
  54. data/spec/fixtures/1.9.1/example_net_http_request.yml +12 -0
  55. data/spec/fixtures/1.9.1/example_net_http_response.yml +25 -0
  56. data/spec/fixtures/1.9.1/fake_example.com_responses.yml +106 -0
  57. data/spec/fixtures/1.9.1/match_requests_on.yml +185 -0
  58. data/spec/fixtures/not_1.9.1/0_3_1_cassette.yml +29 -0
  59. data/spec/fixtures/not_1.9.1/cassette_spec/erb_with_no_vars.yml +32 -0
  60. data/spec/fixtures/not_1.9.1/cassette_spec/erb_with_vars.yml +32 -0
  61. data/spec/fixtures/not_1.9.1/cassette_spec/example.yml +110 -0
  62. data/spec/fixtures/not_1.9.1/cassette_spec/with_localhost_requests.yml +86 -0
  63. data/spec/fixtures/not_1.9.1/example_net_http.yml +14 -0
  64. data/spec/fixtures/not_1.9.1/example_net_http_request.yml +12 -0
  65. data/spec/fixtures/not_1.9.1/example_net_http_response.yml +25 -0
  66. data/spec/fixtures/not_1.9.1/fake_example.com_responses.yml +106 -0
  67. data/spec/fixtures/not_1.9.1/match_requests_on.yml +185 -0
  68. data/spec/http_stubbing_adapters/fakeweb_spec.rb +35 -0
  69. data/spec/http_stubbing_adapters/webmock_spec.rb +35 -0
  70. data/spec/request_matcher_spec.rb +194 -0
  71. data/spec/spec_helper.rb +40 -0
  72. data/spec/structs_spec.rb +121 -0
  73. data/spec/support/disable_warnings.rb +12 -0
  74. data/spec/support/http_library_adapters.rb +272 -0
  75. data/spec/support/http_stubbing_adapter.rb +100 -0
  76. data/spec/support/pending_on_heroku.rb +14 -0
  77. data/spec/support/temp_cassette_library_dir.rb +16 -0
  78. data/spec/support/vcr_localhost_server.rb +53 -0
  79. data/spec/vcr_spec.rb +198 -0
  80. data/spec/version_spec.rb +11 -0
  81. data/vcr.gemspec +43 -0
  82. metadata +134 -73
  83. data/lib/vcr/http_stubbing_adapters/base.rb +0 -36
  84. data/lib/vcr/version.rbc +0 -572
@@ -0,0 +1,63 @@
1
+ ---
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: 200
11
+ :message: OK
12
+ :headers:
13
+ server:
14
+ - Apache/2.2.3 (Red Hat)
15
+ last-modified:
16
+ - Tue, 15 Nov 2005 13:24:10 GMT
17
+ etag:
18
+ - "\"b300b4-1b6-4059a80bfd280\""
19
+ accept-ranges:
20
+ - bytes
21
+ content-type:
22
+ - text/html; charset=UTF-8
23
+ connection:
24
+ - Keep-Alive
25
+ date:
26
+ - Thu, 28 Jan 2010 07:14:48 GMT
27
+ age:
28
+ - "1696"
29
+ content-length:
30
+ - "438"
31
+ :body: The before_nested response
32
+ :http_version: "1.1"
33
+ - !ruby/struct:VCR::HTTPInteraction
34
+ :request: !ruby/struct:VCR::Request
35
+ :method: :get
36
+ :uri: http://example.com:80/after_nested
37
+ :body:
38
+ :headers:
39
+ :response: !ruby/struct:VCR::Response
40
+ :status: !ruby/struct:VCR::ResponseStatus
41
+ :code: 200
42
+ :message: OK
43
+ :headers:
44
+ server:
45
+ - Apache/2.2.3 (Red Hat)
46
+ last-modified:
47
+ - Tue, 15 Nov 2005 13:24:10 GMT
48
+ etag:
49
+ - "\"b300b4-1b6-4059a80bfd280\""
50
+ accept-ranges:
51
+ - bytes
52
+ content-type:
53
+ - text/html; charset=UTF-8
54
+ connection:
55
+ - Keep-Alive
56
+ date:
57
+ - Thu, 28 Jan 2010 07:14:48 GMT
58
+ age:
59
+ - "1696"
60
+ content-length:
61
+ - "438"
62
+ :body: The after_nested response
63
+ :http_version: "1.1"
@@ -0,0 +1,85 @@
1
+ ---
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:
13
+ server:
14
+ - Apache/2.2.3 (Red Hat)
15
+ last-modified:
16
+ - Tue, 15 Nov 2005 13:24:10 GMT
17
+ etag:
18
+ - "\"b300b4-1b6-4059a80bfd280\""
19
+ accept-ranges:
20
+ - bytes
21
+ content-type:
22
+ - text/html; charset=UTF-8
23
+ connection:
24
+ - Keep-Alive
25
+ date:
26
+ - Thu, 28 Jan 2010 07:14:48 GMT
27
+ age:
28
+ - "1696"
29
+ content-length:
30
+ - "438"
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
+
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:
55
+ server:
56
+ - Apache/2.2.3 (Red Hat)
57
+ last-modified:
58
+ - Tue, 15 Nov 2005 13:24:10 GMT
59
+ etag:
60
+ - "\"b300b4-1b6-4059a80bfd280\""
61
+ accept-ranges:
62
+ - bytes
63
+ content-type:
64
+ - text/html; charset=UTF-8
65
+ connection:
66
+ - Keep-Alive
67
+ date:
68
+ - Thu, 28 Jan 2010 07:14:48 GMT
69
+ age:
70
+ - "1696"
71
+ content-length:
72
+ - "438"
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
+
85
+ :http_version: "1.1"
@@ -0,0 +1,36 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ :request: !ruby/struct:VCR::Request
4
+ :method: :get
5
+ :uri: http://example.com:80/embedded_ruby_code
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
+ connection:
18
+ - Keep-Alive
19
+ content-type:
20
+ - text/html; charset=UTF-8
21
+ date:
22
+ - Thu, 25 Feb 2010 15:20:47 GMT
23
+ server:
24
+ - Apache/2.2.3 (CentOS)
25
+ content-length:
26
+ - "438"
27
+ age:
28
+ - "2546"
29
+ accept-ranges:
30
+ - bytes
31
+ :body: |
32
+ Some embedded ruby code: <%= 4 + 3 %>
33
+ The value of some_variable is: <%= some_variable %>
34
+
35
+ :http_version: "1.1"
36
+
@@ -0,0 +1,35 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ :request: !ruby/struct:VCR::Request
4
+ :method: :post
5
+ :uri: http://example.com:80/
6
+ :body: foo=bar
7
+ :headers:
8
+ x-http-user:
9
+ - bob
10
+ :response: !ruby/struct:VCR::Response
11
+ :status: !ruby/struct:VCR::ResponseStatus
12
+ :code: 200
13
+ :message: OK
14
+ :headers:
15
+ etag:
16
+ - "\"24ec5-1b6-4059a80bfd280\""
17
+ :body: foo=bar response | bob response
18
+ :http_version: "1.1"
19
+ - !ruby/struct:VCR::HTTPInteraction
20
+ :request: !ruby/struct:VCR::Request
21
+ :method: :post
22
+ :uri: http://example.com:80/
23
+ :body: bar=bazz
24
+ :headers:
25
+ x-http-user:
26
+ - joe
27
+ :response: !ruby/struct:VCR::Response
28
+ :status: !ruby/struct:VCR::ResponseStatus
29
+ :code: 200
30
+ :message: OK
31
+ :headers:
32
+ etag:
33
+ - "\"24ec5-1b6-4059a80bfd280\""
34
+ :body: bar=bazz response | joe response
35
+ :http_version: "1.1"
@@ -0,0 +1,32 @@
1
+ ---
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: 200
11
+ :message: OK
12
+ :headers:
13
+ server:
14
+ - Apache/2.2.3 (Red Hat)
15
+ last-modified:
16
+ - Tue, 15 Nov 2005 13:24:10 GMT
17
+ etag:
18
+ - "\"b300b4-1b6-4059a80bfd280\""
19
+ accept-ranges:
20
+ - bytes
21
+ content-type:
22
+ - text/html; charset=UTF-8
23
+ connection:
24
+ - Keep-Alive
25
+ date:
26
+ - Thu, 28 Jan 2010 07:14:48 GMT
27
+ age:
28
+ - "1696"
29
+ content-length:
30
+ - "438"
31
+ :body: The nested response
32
+ :http_version: "1.1"
@@ -0,0 +1,43 @@
1
+ ---
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:
13
+ server:
14
+ - Apache/2.2.3 (Red Hat)
15
+ last-modified:
16
+ - Tue, 15 Nov 2005 13:24:10 GMT
17
+ etag:
18
+ - "\"b300b4-1b6-4059a80bfd280\""
19
+ accept-ranges:
20
+ - bytes
21
+ content-type:
22
+ - text/html; charset=UTF-8
23
+ connection:
24
+ - Keep-Alive
25
+ date:
26
+ - Thu, 28 Jan 2010 07:14:48 GMT
27
+ age:
28
+ - "1696"
29
+ content-length:
30
+ - "438"
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
+
43
+ :http_version: "1.1"
@@ -0,0 +1,32 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ :request: !ruby/struct:VCR::Request
4
+ :method: :get
5
+ :uri: http://localhost/
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
+ connection:
18
+ - Keep-Alive
19
+ content-type:
20
+ - text/html; charset=UTF-8
21
+ date:
22
+ - Thu, 25 Feb 2010 15:22:32 GMT
23
+ server:
24
+ - Apache/2.2.3 (CentOS)
25
+ content-length:
26
+ - "438"
27
+ age:
28
+ - "2643"
29
+ accept-ranges:
30
+ - bytes
31
+ :body: This is a fake response.
32
+ :http_version: "1.1"
@@ -0,0 +1,43 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: !ruby/regexp /example\.com\/reg/
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
+ connection:
18
+ - Keep-Alive
19
+ content-type:
20
+ - text/html; charset=UTF-8
21
+ date:
22
+ - Thu, 25 Feb 2010 15:22:32 GMT
23
+ server:
24
+ - Apache/2.2.3 (CentOS)
25
+ content-length:
26
+ - "438"
27
+ age:
28
+ - "2643"
29
+ accept-ranges:
30
+ - bytes
31
+ body: |
32
+ <HTML>
33
+ <HEAD>
34
+ <TITLE>Example Web Page</TITLE>
35
+ </HEAD>
36
+ <body>
37
+ <p>
38
+ This is the response from the regex cassette
39
+ </p>
40
+ </BODY>
41
+ </HTML>
42
+
43
+ http_version: "1.1"
@@ -0,0 +1,43 @@
1
+ ---
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:
13
+ last-modified:
14
+ - Tue, 15 Nov 2005 13:24:10 GMT
15
+ connection:
16
+ - Keep-Alive
17
+ etag:
18
+ - "\"24ec5-1b6-4059a80bfd280\""
19
+ content-type:
20
+ - text/html; charset=UTF-8
21
+ date:
22
+ - Thu, 25 Feb 2010 15:22:32 GMT
23
+ server:
24
+ - Apache/2.2.3 (CentOS)
25
+ content-length:
26
+ - "438"
27
+ age:
28
+ - "2643"
29
+ accept-ranges:
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
+
43
+ http_version: "1.1"
@@ -0,0 +1,47 @@
1
+ ---
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:
13
+ connection:
14
+ - close
15
+ content-type:
16
+ - text/html; charset=iso-8859-1
17
+ date:
18
+ - Thu, 25 Feb 2010 15:23:39 GMT
19
+ server:
20
+ - Apache/2.2.3 (CentOS)
21
+ content-length:
22
+ - "287"
23
+ body: The before_nested response
24
+ http_version: "1.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:
36
+ connection:
37
+ - close
38
+ content-type:
39
+ - text/html; charset=iso-8859-1
40
+ date:
41
+ - Thu, 25 Feb 2010 15:23:39 GMT
42
+ server:
43
+ - Apache/2.2.3 (CentOS)
44
+ content-length:
45
+ - "286"
46
+ body: The after_nested response
47
+ http_version: "1.1"