vcr 2.5.0 → 2.6.0

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 (79) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +0 -3
  3. data/CHANGELOG.md +32 -3
  4. data/Gemfile +33 -0
  5. data/Gemfile.lock +99 -119
  6. data/README.md +19 -7
  7. data/Rakefile +5 -9
  8. data/benchmarks/null_logging.rb +62 -0
  9. data/features/.nav +0 -1
  10. data/features/about_these_examples.md +1 -2
  11. data/features/cassettes/allow_unused_http_interactions.feature +15 -1
  12. data/features/cassettes/decompress.feature +6 -2
  13. data/features/cassettes/format.feature +20 -12
  14. data/features/cassettes/freezing_time.feature +68 -0
  15. data/features/configuration/cassette_library_dir.feature +5 -0
  16. data/features/configuration/preserve_exact_body_bytes.feature +5 -0
  17. data/features/configuration/uri_parser.feature +2 -4
  18. data/features/http_libraries/net_http.feature +1 -1
  19. data/features/request_matching/headers.feature +0 -1
  20. data/features/step_definitions/cli_steps.rb +1 -4
  21. data/features/test_frameworks/cucumber.feature +59 -0
  22. data/features/test_frameworks/rspec_metadata.feature +59 -1
  23. data/gemfiles/typhoeus_old.gemfile +19 -0
  24. data/gemfiles/typhoeus_old.gemfile.lock +84 -86
  25. data/lib/vcr.rb +12 -3
  26. data/lib/vcr/cassette.rb +32 -11
  27. data/lib/vcr/cassette/http_interaction_list.rb +3 -2
  28. data/lib/vcr/cassette/migrator.rb +1 -0
  29. data/lib/vcr/cassette/serializers/json.rb +1 -1
  30. data/lib/vcr/configuration.rb +17 -9
  31. data/lib/vcr/library_hooks/typhoeus.rb +3 -2
  32. data/lib/vcr/library_hooks/webmock.rb +1 -1
  33. data/lib/vcr/middleware/excon.rb +13 -1
  34. data/lib/vcr/middleware/faraday.rb +1 -0
  35. data/lib/vcr/request_handler.rb +1 -1
  36. data/lib/vcr/structs.rb +19 -4
  37. data/lib/vcr/test_frameworks/cucumber.rb +2 -2
  38. data/lib/vcr/test_frameworks/rspec.rb +10 -2
  39. data/lib/vcr/util/logger.rb +41 -7
  40. data/lib/vcr/version.rb +1 -1
  41. data/script/ci.sh +8 -1
  42. data/spec/acceptance/threading_spec.rb +6 -0
  43. data/spec/capture_warnings.rb +9 -1
  44. data/spec/spec_helper.rb +6 -2
  45. data/spec/support/configuration_stubbing.rb +8 -0
  46. data/spec/support/http_library_adapters.rb +1 -1
  47. data/spec/support/limited_uri.rb +1 -0
  48. data/spec/support/shared_example_groups/excon.rb +23 -1
  49. data/spec/support/shared_example_groups/hook_into_http_library.rb +12 -12
  50. data/spec/support/shared_example_groups/request_hooks.rb +1 -1
  51. data/spec/support/sinatra_app.rb +9 -0
  52. data/spec/support/vcr_localhost_server.rb +4 -25
  53. data/spec/support/vcr_stub_helpers.rb +1 -1
  54. data/spec/vcr/cassette/http_interaction_list_spec.rb +41 -14
  55. data/spec/vcr/cassette/migrator_spec.rb +1 -1
  56. data/spec/vcr/cassette/persisters_spec.rb +2 -2
  57. data/spec/vcr/cassette/serializers_spec.rb +13 -4
  58. data/spec/vcr/cassette_spec.rb +107 -58
  59. data/spec/vcr/configuration_spec.rb +23 -23
  60. data/spec/vcr/deprecations_spec.rb +9 -9
  61. data/spec/vcr/errors_spec.rb +6 -6
  62. data/spec/vcr/library_hooks/excon_spec.rb +15 -10
  63. data/spec/vcr/library_hooks/fakeweb_spec.rb +8 -8
  64. data/spec/vcr/library_hooks/faraday_spec.rb +1 -1
  65. data/spec/vcr/library_hooks/typhoeus_0.4_spec.rb +2 -2
  66. data/spec/vcr/library_hooks/typhoeus_spec.rb +68 -9
  67. data/spec/vcr/library_hooks/webmock_spec.rb +6 -10
  68. data/spec/vcr/middleware/faraday_spec.rb +33 -5
  69. data/spec/vcr/middleware/rack_spec.rb +2 -2
  70. data/spec/vcr/request_matcher_registry_spec.rb +11 -6
  71. data/spec/vcr/structs_spec.rb +114 -47
  72. data/spec/vcr/test_frameworks/cucumber_spec.rb +4 -4
  73. data/spec/vcr/util/hooks_spec.rb +2 -2
  74. data/spec/vcr/util/internet_connection_spec.rb +3 -3
  75. data/spec/vcr/util/version_checker_spec.rb +4 -4
  76. data/spec/vcr_spec.rb +22 -16
  77. data/vcr.gemspec +2 -31
  78. metadata +9 -328
  79. data/features/test_frameworks/shoulda.feature +0 -64
@@ -1,64 +0,0 @@
1
- Feature: Usage with Shoulda
2
-
3
- When using a test framework that provides setup and teardown hooks
4
- (such as shoulda), you can use `VCR.insert_cassette` and
5
- `VCR.eject_cassette` to use a cassette for some tests.
6
-
7
- The first argument to `VCR.insert_cassette` should be the cassette
8
- name; you can follow that with a hash of cassette options.
9
-
10
- Note that you _must_ eject every cassette you insert; if you use
11
- `VCR.insert_cassette` rather than wrapping code in `VCR.use_cassette`,
12
- then it is your responsibility to ensure it is ejected, even if
13
- errors occur.
14
-
15
- Scenario: Use `VCR.insert_cassette` and `VCR.eject_cassette`
16
- Given a file named "test/test_server.rb" with:
17
- """ruby
18
- start_sinatra_app(:port => 7777) do
19
- get('/') { "Hello" }
20
- end
21
- """
22
- Given a file named "test/test_helper.rb" with:
23
- """ruby
24
- require 'test/test_server' if ENV['SERVER'] == 'true'
25
- require 'test/unit'
26
- require 'shoulda'
27
- require 'vcr'
28
-
29
- VCR.configure do |c|
30
- c.hook_into :webmock
31
- c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
32
- end
33
- """
34
- And a file named "test/vcr_example_test.rb" with:
35
- """ruby
36
- require 'test_helper'
37
-
38
- class VCRExampleTest < Test::Unit::TestCase
39
- context 'using a VCR cassette' do
40
- setup do
41
- VCR.insert_cassette('shoulda_example')
42
- end
43
-
44
- should 'make an HTTP request' do
45
- response = Net::HTTP.get_response('localhost', '/', 7777)
46
- assert_equal "Hello", response.body
47
- end
48
-
49
- teardown do
50
- VCR.eject_cassette
51
- end
52
- end
53
- end
54
- """
55
- And the directory "test/fixtures/vcr_cassettes" does not exist
56
- When I set the "SERVER" environment variable to "true"
57
- And I run `ruby -Itest test/vcr_example_test.rb`
58
- Then it should pass with "1 tests, 1 assertions, 0 failures, 0 errors"
59
- And the file "test/fixtures/vcr_cassettes/shoulda_example.yml" should contain "Hello"
60
-
61
- # Run again without starting the sinatra server so the response will be replayed
62
- When I set the "SERVER" environment variable to "false"
63
- And I run `ruby -Itest test/vcr_example_test.rb`
64
- Then it should pass with "1 tests, 1 assertions, 0 failures, 0 errors"