vcr 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +0 -3
- data/CHANGELOG.md +32 -3
- data/Gemfile +33 -0
- data/Gemfile.lock +99 -119
- data/README.md +19 -7
- data/Rakefile +5 -9
- data/benchmarks/null_logging.rb +62 -0
- data/features/.nav +0 -1
- data/features/about_these_examples.md +1 -2
- data/features/cassettes/allow_unused_http_interactions.feature +15 -1
- data/features/cassettes/decompress.feature +6 -2
- data/features/cassettes/format.feature +20 -12
- data/features/cassettes/freezing_time.feature +68 -0
- data/features/configuration/cassette_library_dir.feature +5 -0
- data/features/configuration/preserve_exact_body_bytes.feature +5 -0
- data/features/configuration/uri_parser.feature +2 -4
- data/features/http_libraries/net_http.feature +1 -1
- data/features/request_matching/headers.feature +0 -1
- data/features/step_definitions/cli_steps.rb +1 -4
- data/features/test_frameworks/cucumber.feature +59 -0
- data/features/test_frameworks/rspec_metadata.feature +59 -1
- data/gemfiles/typhoeus_old.gemfile +19 -0
- data/gemfiles/typhoeus_old.gemfile.lock +84 -86
- data/lib/vcr.rb +12 -3
- data/lib/vcr/cassette.rb +32 -11
- data/lib/vcr/cassette/http_interaction_list.rb +3 -2
- data/lib/vcr/cassette/migrator.rb +1 -0
- data/lib/vcr/cassette/serializers/json.rb +1 -1
- data/lib/vcr/configuration.rb +17 -9
- data/lib/vcr/library_hooks/typhoeus.rb +3 -2
- data/lib/vcr/library_hooks/webmock.rb +1 -1
- data/lib/vcr/middleware/excon.rb +13 -1
- data/lib/vcr/middleware/faraday.rb +1 -0
- data/lib/vcr/request_handler.rb +1 -1
- data/lib/vcr/structs.rb +19 -4
- data/lib/vcr/test_frameworks/cucumber.rb +2 -2
- data/lib/vcr/test_frameworks/rspec.rb +10 -2
- data/lib/vcr/util/logger.rb +41 -7
- data/lib/vcr/version.rb +1 -1
- data/script/ci.sh +8 -1
- data/spec/acceptance/threading_spec.rb +6 -0
- data/spec/capture_warnings.rb +9 -1
- data/spec/spec_helper.rb +6 -2
- data/spec/support/configuration_stubbing.rb +8 -0
- data/spec/support/http_library_adapters.rb +1 -1
- data/spec/support/limited_uri.rb +1 -0
- data/spec/support/shared_example_groups/excon.rb +23 -1
- data/spec/support/shared_example_groups/hook_into_http_library.rb +12 -12
- data/spec/support/shared_example_groups/request_hooks.rb +1 -1
- data/spec/support/sinatra_app.rb +9 -0
- data/spec/support/vcr_localhost_server.rb +4 -25
- data/spec/support/vcr_stub_helpers.rb +1 -1
- data/spec/vcr/cassette/http_interaction_list_spec.rb +41 -14
- data/spec/vcr/cassette/migrator_spec.rb +1 -1
- data/spec/vcr/cassette/persisters_spec.rb +2 -2
- data/spec/vcr/cassette/serializers_spec.rb +13 -4
- data/spec/vcr/cassette_spec.rb +107 -58
- data/spec/vcr/configuration_spec.rb +23 -23
- data/spec/vcr/deprecations_spec.rb +9 -9
- data/spec/vcr/errors_spec.rb +6 -6
- data/spec/vcr/library_hooks/excon_spec.rb +15 -10
- data/spec/vcr/library_hooks/fakeweb_spec.rb +8 -8
- data/spec/vcr/library_hooks/faraday_spec.rb +1 -1
- data/spec/vcr/library_hooks/typhoeus_0.4_spec.rb +2 -2
- data/spec/vcr/library_hooks/typhoeus_spec.rb +68 -9
- data/spec/vcr/library_hooks/webmock_spec.rb +6 -10
- data/spec/vcr/middleware/faraday_spec.rb +33 -5
- data/spec/vcr/middleware/rack_spec.rb +2 -2
- data/spec/vcr/request_matcher_registry_spec.rb +11 -6
- data/spec/vcr/structs_spec.rb +114 -47
- data/spec/vcr/test_frameworks/cucumber_spec.rb +4 -4
- data/spec/vcr/util/hooks_spec.rb +2 -2
- data/spec/vcr/util/internet_connection_spec.rb +3 -3
- data/spec/vcr/util/version_checker_spec.rb +4 -4
- data/spec/vcr_spec.rb +22 -16
- data/vcr.gemspec +2 -31
- metadata +9 -328
- 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"
|