Skip to content

Commit

Permalink
Deprecate VCR::Config in favor of VCR.configuration and `VCR.conf…
Browse files Browse the repository at this point in the history
…ig` in favor of `VCR.configure`.

- "config" is ambiguous--is it short for "configure" (the verb) or "configuration" (the noun)?
- I like this new way since it's more inline with other ruby libraries like RSpec.
- The old singleton module made isolated tests hard as there was a lot of global state to cleanup between tests.  Now there is just one piece of state: the VCR::Configuration instance held by VCR.configuration.  This makes it far easier to keep my tests isolated.
  • Loading branch information
myronmarston committed Sep 12, 2011
1 parent 5905942 commit e36ed0e
Show file tree
Hide file tree
Showing 41 changed files with 260 additions and 197 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,10 @@


* Removed support for Ruby 1.8.6 and 1.9.1. * Removed support for Ruby 1.8.6 and 1.9.1.
* Removed lots of old deprecated APIs. * Removed lots of old deprecated APIs.
* Deprecated `VCR.config` in favor of `VCR.configure`.
* Deprecated `VCR::Config` singleton module in favor of
`VCR::Configuration` class. The current configuration instance
can be accessed via `VCR.configuration`.


## 1.11.3 (August 31, 2011) ## 1.11.3 (August 31, 2011)


Expand Down
2 changes: 1 addition & 1 deletion features/cassettes/automatic_re_recording.feature
Expand Up @@ -40,7 +40,7 @@ Feature: Automatic Re-recording
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down
4 changes: 2 additions & 2 deletions features/cassettes/dynamic_erb.feature
Expand Up @@ -35,7 +35,7 @@ Feature: Dynamic ERB cassettes
"""ruby """ruby
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down Expand Up @@ -74,7 +74,7 @@ Feature: Dynamic ERB cassettes
"""ruby """ruby
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down
2 changes: 1 addition & 1 deletion features/cassettes/format.feature
Expand Up @@ -30,7 +30,7 @@ Feature: Cassette format
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down
2 changes: 1 addition & 1 deletion features/cassettes/naming.feature
Expand Up @@ -15,7 +15,7 @@ Feature: Naming
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.stub_with :fakeweb c.stub_with :fakeweb
end end
Expand Down
8 changes: 4 additions & 4 deletions features/cassettes/no_cassette.feature
Expand Up @@ -27,7 +27,7 @@ Feature: Error for HTTP request made when no cassette is in use
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down Expand Up @@ -62,7 +62,7 @@ Feature: Error for HTTP request made when no cassette is in use
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
end end
Expand Down Expand Up @@ -112,7 +112,7 @@ Feature: Error for HTTP request made when no cassette is in use
"""ruby """ruby
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
end end
Expand All @@ -133,7 +133,7 @@ Feature: Error for HTTP request made when no cassette is in use
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.stub_with :fakeweb c.stub_with :fakeweb
end end
Expand Down
10 changes: 5 additions & 5 deletions features/cassettes/request_matching.feature
Expand Up @@ -69,7 +69,7 @@ Feature: Request matching
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down Expand Up @@ -139,7 +139,7 @@ Feature: Request matching
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down Expand Up @@ -213,7 +213,7 @@ Feature: Request matching
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down Expand Up @@ -286,7 +286,7 @@ Feature: Request matching
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down Expand Up @@ -355,7 +355,7 @@ Feature: Request matching
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down
2 changes: 1 addition & 1 deletion features/cassettes/update_content_length_header.feature
Expand Up @@ -44,7 +44,7 @@ Feature: Update content_length header
"""ruby """ruby
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.stub_with :fakeweb c.stub_with :fakeweb
end end
Expand Down
Expand Up @@ -18,7 +18,7 @@ Feature: Allow HTTP connections when no cassette
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.allow_http_connections_when_no_cassette = true c.allow_http_connections_when_no_cassette = true
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
Expand Down
2 changes: 1 addition & 1 deletion features/configuration/cassette_library_dir.feature
Expand Up @@ -14,7 +14,7 @@ Feature: cassette_library_dir
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.cassette_library_dir = 'vcr/cassettes' c.cassette_library_dir = 'vcr/cassettes'
c.stub_with :fakeweb c.stub_with :fakeweb
end end
Expand Down
4 changes: 2 additions & 2 deletions features/configuration/default_cassette_options.feature
Expand Up @@ -14,7 +14,7 @@ Feature: default_cassette_options
"""ruby """ruby
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.default_cassette_options = { :record => :new_episodes, :erb => true } c.default_cassette_options = { :record => :new_episodes, :erb => true }
# not important for this example, but must be set to something # not important for this example, but must be set to something
Expand Down Expand Up @@ -57,7 +57,7 @@ Feature: default_cassette_options
"""ruby """ruby
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
# not important for this example, but must be set to something # not important for this example, but must be set to something
c.stub_with :webmock c.stub_with :webmock
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
Expand Down
6 changes: 3 additions & 3 deletions features/configuration/filter_sensitive_data.feature
Expand Up @@ -36,7 +36,7 @@ Feature: Filter sensitive data
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.filter_sensitive_data('<GREETING>') { 'Hello' } c.filter_sensitive_data('<GREETING>') { 'Hello' }
Expand Down Expand Up @@ -71,7 +71,7 @@ Feature: Filter sensitive data
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.filter_sensitive_data('<LOCATION>', :my_tag) { 'World' } c.filter_sensitive_data('<LOCATION>', :my_tag) { 'World' }
Expand Down Expand Up @@ -125,7 +125,7 @@ Feature: Filter sensitive data
'jane.doe' => 'cheetah' 'jane.doe' => 'cheetah'
} }
VCR.config do |c| VCR.configure do |c|
c.stub_with :webmock c.stub_with :webmock
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.filter_sensitive_data('<PASSWORD>') do |interaction| c.filter_sensitive_data('<PASSWORD>') do |interaction|
Expand Down
16 changes: 8 additions & 8 deletions features/configuration/hooks.feature
Expand Up @@ -7,7 +7,7 @@ Feature: Hooks
- `before_playback`: Called before a cassette sets up its stubs for playback. - `before_playback`: Called before a cassette sets up its stubs for playback.


To use these, call `config.before_record` or `config.before_playback` in To use these, call `config.before_record` or `config.before_playback` in
your `VCR.config` block. Provide a block that accepts 0, 1 or 2 arguments. your `VCR.configure` block. Provide a block that accepts 0, 1 or 2 arguments.


The first argument, if the block accepts it, will be an HTTP interaction. The first argument, if the block accepts it, will be an HTTP interaction.
Changes you make to the interaction will be reflected in the recording or Changes you make to the interaction will be reflected in the recording or
Expand All @@ -22,7 +22,7 @@ Feature: Hooks
You can also use tagging to apply hooks to particular cassettes. Consider You can also use tagging to apply hooks to particular cassettes. Consider
this code: this code:


VCR.config do |c| VCR.configure do |c|
c.before_record(:twitter) { ... } # modify the interactions somehow c.before_record(:twitter) { ... } # modify the interactions somehow
end end


Expand Down Expand Up @@ -69,7 +69,7 @@ Feature: Hooks
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
Expand Down Expand Up @@ -98,7 +98,7 @@ Feature: Hooks
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.before_record { |i| i.ignore! } c.before_record { |i| i.ignore! }
Expand All @@ -118,7 +118,7 @@ Feature: Hooks
"""ruby """ruby
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
Expand Down Expand Up @@ -167,7 +167,7 @@ Feature: Hooks
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.before_playback { |i| i.ignore! } c.before_playback { |i| i.ignore! }
Expand All @@ -192,7 +192,7 @@ Feature: Hooks
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
Expand Down Expand Up @@ -233,7 +233,7 @@ Feature: Hooks
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :fakeweb c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
Expand Down
2 changes: 1 addition & 1 deletion features/configuration/ignore_hosts.feature
Expand Up @@ -29,7 +29,7 @@ Feature: ignore_hosts
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.ignore_hosts '127.0.0.1', 'localhost' c.ignore_hosts '127.0.0.1', 'localhost'
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.stub_with <stub_with> c.stub_with <stub_with>
Expand Down
4 changes: 2 additions & 2 deletions features/configuration/ignore_localhost.feature
Expand Up @@ -29,7 +29,7 @@ Feature: ignore_localhost
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
<additional_config> <additional_config>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.stub_with <stub_with> c.stub_with <stub_with>
Expand Down Expand Up @@ -73,7 +73,7 @@ Feature: ignore_localhost
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.ignore_localhost = true c.ignore_localhost = true
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.stub_with <stub_with> c.stub_with <stub_with>
Expand Down
4 changes: 2 additions & 2 deletions features/configuration/stub_with.feature
Expand Up @@ -55,7 +55,7 @@ Feature: stub_with
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'vcr_cassettes' c.cassette_library_dir = 'vcr_cassettes'
end end
Expand Down Expand Up @@ -128,7 +128,7 @@ Feature: stub_with
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with>, :typhoeus, :excon, :faraday c.stub_with <stub_with>, :typhoeus, :excon, :faraday
c.cassette_library_dir = 'vcr_cassettes' c.cassette_library_dir = 'vcr_cassettes'
end end
Expand Down
2 changes: 1 addition & 1 deletion features/http_libraries/em_http_request.feature
Expand Up @@ -22,7 +22,7 @@ Feature: EM HTTP Request
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with :webmock c.stub_with :webmock
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down
10 changes: 5 additions & 5 deletions features/http_libraries/net_http.feature
Expand Up @@ -24,7 +24,7 @@ Feature: Net::HTTP
"""ruby """ruby
require 'vcr_setup.rb' require 'vcr_setup.rb'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand All @@ -50,7 +50,7 @@ Feature: Net::HTTP
"""ruby """ruby
require 'vcr_setup.rb' require 'vcr_setup.rb'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down Expand Up @@ -82,7 +82,7 @@ Feature: Net::HTTP
"""ruby """ruby
require 'vcr_setup.rb' require 'vcr_setup.rb'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down Expand Up @@ -115,7 +115,7 @@ Feature: Net::HTTP
require 'open-uri' require 'open-uri'
require 'vcr_setup.rb' require 'vcr_setup.rb'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand All @@ -141,7 +141,7 @@ Feature: Net::HTTP
"""ruby """ruby
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.stub_with <stub_with> c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
end end
Expand Down
2 changes: 1 addition & 1 deletion features/middleware/faraday.feature
Expand Up @@ -22,7 +22,7 @@ Feature: Faraday middleware
require 'vcr' require 'vcr'
VCR.config do |c| VCR.configure do |c|
c.cassette_library_dir = 'cassettes' c.cassette_library_dir = 'cassettes'
c.stub_with :faraday c.stub_with :faraday
end end
Expand Down

0 comments on commit e36ed0e

Please sign in to comment.