Permalink
Browse files

Deprecate `VCR::Config` in favor of `VCR.configuration` and `VCR.conf…

…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 11, 2011
1 parent 5905942 commit e36ed0e812b3a1650090d011d1bf972ae503ad79
Showing with 260 additions and 197 deletions.
  1. +4 −0 CHANGELOG.md
  2. +1 −1 features/cassettes/automatic_re_recording.feature
  3. +2 −2 features/cassettes/dynamic_erb.feature
  4. +1 −1 features/cassettes/format.feature
  5. +1 −1 features/cassettes/naming.feature
  6. +4 −4 features/cassettes/no_cassette.feature
  7. +5 −5 features/cassettes/request_matching.feature
  8. +1 −1 features/cassettes/update_content_length_header.feature
  9. +1 −1 features/configuration/allow_http_connections_when_no_cassette.feature
  10. +1 −1 features/configuration/cassette_library_dir.feature
  11. +2 −2 features/configuration/default_cassette_options.feature
  12. +3 −3 features/configuration/filter_sensitive_data.feature
  13. +8 −8 features/configuration/hooks.feature
  14. +1 −1 features/configuration/ignore_hosts.feature
  15. +2 −2 features/configuration/ignore_localhost.feature
  16. +2 −2 features/configuration/stub_with.feature
  17. +1 −1 features/http_libraries/em_http_request.feature
  18. +5 −5 features/http_libraries/net_http.feature
  19. +1 −1 features/middleware/faraday.feature
  20. +2 −2 features/middleware/rack.feature
  21. +1 −1 features/record_modes/all.feature
  22. +1 −1 features/record_modes/new_episodes.feature
  23. +1 −1 features/record_modes/none.feature
  24. +1 −1 features/record_modes/once.feature
  25. +1 −1 features/test_frameworks/cucumber.feature
  26. +2 −2 features/test_frameworks/rspec.feature
  27. +1 −1 features/test_frameworks/shoulda.feature
  28. +1 −1 features/test_frameworks/test_unit.feature
  29. +13 −7 lib/vcr.rb
  30. +6 −6 lib/vcr/cassette.rb
  31. +5 −8 lib/vcr/{config.rb → configuration.rb}
  32. +12 −0 lib/vcr/deprecations/vcr.rb
  33. +1 −1 lib/vcr/http_stubbing_adapters/common.rb
  34. +19 −13 lib/vcr/util/hooks.rb
  35. +5 −21 spec/spec_helper.rb
  36. +2 −2 spec/support/shared_example_groups/http_stubbing_adapter.rb
  37. +6 −6 spec/support/shared_example_groups/ignore_localhost_deprecation.rb
  38. +32 −30 spec/vcr/cassette_spec.rb
  39. +34 −34 spec/vcr/{config_spec.rb → configuration_spec.rb}
  40. +42 −0 spec/vcr/deprecations/vcr_spec.rb
  41. +26 −16 spec/vcr_spec.rb
View
@@ -4,6 +4,10 @@
* Removed support for Ruby 1.8.6 and 1.9.1.
* 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)
@@ -40,7 +40,7 @@ Feature: Automatic Re-recording
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
end
@@ -35,7 +35,7 @@ Feature: Dynamic ERB cassettes
"""ruby
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
end
@@ -74,7 +74,7 @@ Feature: Dynamic ERB cassettes
"""ruby
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
end
@@ -30,7 +30,7 @@ Feature: Cassette format
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -15,7 +15,7 @@ Feature: Naming
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.cassette_library_dir = 'cassettes'
c.stub_with :fakeweb
end
@@ -27,7 +27,7 @@ Feature: Error for HTTP request made when no cassette is in use
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -62,7 +62,7 @@ Feature: Error for HTTP request made when no cassette is in use
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
end
@@ -112,7 +112,7 @@ Feature: Error for HTTP request made when no cassette is in use
"""ruby
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
end
@@ -133,7 +133,7 @@ Feature: Error for HTTP request made when no cassette is in use
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.cassette_library_dir = 'cassettes'
c.stub_with :fakeweb
end
@@ -69,7 +69,7 @@ Feature: Request matching
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -139,7 +139,7 @@ Feature: Request matching
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -213,7 +213,7 @@ Feature: Request matching
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -286,7 +286,7 @@ Feature: Request matching
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -355,7 +355,7 @@ Feature: Request matching
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -44,7 +44,7 @@ Feature: Update content_length header
"""ruby
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.cassette_library_dir = 'cassettes'
c.stub_with :fakeweb
end
@@ -18,7 +18,7 @@ Feature: Allow HTTP connections when no cassette
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.allow_http_connections_when_no_cassette = true
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
@@ -14,7 +14,7 @@ Feature: cassette_library_dir
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.cassette_library_dir = 'vcr/cassettes'
c.stub_with :fakeweb
end
@@ -14,7 +14,7 @@ Feature: default_cassette_options
"""ruby
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.default_cassette_options = { :record => :new_episodes, :erb => true }
# not important for this example, but must be set to something
@@ -57,7 +57,7 @@ Feature: default_cassette_options
"""ruby
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
# not important for this example, but must be set to something
c.stub_with :webmock
c.cassette_library_dir = 'cassettes'
@@ -36,7 +36,7 @@ Feature: Filter sensitive data
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
c.filter_sensitive_data('<GREETING>') { 'Hello' }
@@ -71,7 +71,7 @@ Feature: Filter sensitive data
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
c.filter_sensitive_data('<LOCATION>', :my_tag) { 'World' }
@@ -125,7 +125,7 @@ Feature: Filter sensitive data
'jane.doe' => 'cheetah'
}
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :webmock
c.cassette_library_dir = 'cassettes'
c.filter_sensitive_data('<PASSWORD>') do |interaction|
@@ -7,7 +7,7 @@ Feature: Hooks
- `before_playback`: Called before a cassette sets up its stubs for playback.
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.
Changes you make to the interaction will be reflected in the recording or
@@ -22,7 +22,7 @@ Feature: Hooks
You can also use tagging to apply hooks to particular cassettes. Consider
this code:
- VCR.config do |c|
+ VCR.configure do |c|
c.before_record(:twitter) { ... } # modify the interactions somehow
end
@@ -69,7 +69,7 @@ Feature: Hooks
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
@@ -98,7 +98,7 @@ Feature: Hooks
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
c.before_record { |i| i.ignore! }
@@ -118,7 +118,7 @@ Feature: Hooks
"""ruby
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
@@ -167,7 +167,7 @@ Feature: Hooks
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
c.before_playback { |i| i.ignore! }
@@ -192,7 +192,7 @@ Feature: Hooks
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
@@ -233,7 +233,7 @@ Feature: Hooks
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'cassettes'
@@ -29,7 +29,7 @@ Feature: ignore_hosts
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.ignore_hosts '127.0.0.1', 'localhost'
c.cassette_library_dir = 'cassettes'
c.stub_with <stub_with>
@@ -29,7 +29,7 @@ Feature: ignore_localhost
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
<additional_config>
c.cassette_library_dir = 'cassettes'
c.stub_with <stub_with>
@@ -73,7 +73,7 @@ Feature: ignore_localhost
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.ignore_localhost = true
c.cassette_library_dir = 'cassettes'
c.stub_with <stub_with>
@@ -55,7 +55,7 @@ Feature: stub_with
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'vcr_cassettes'
end
@@ -128,7 +128,7 @@ Feature: stub_with
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>, :typhoeus, :excon, :faraday
c.cassette_library_dir = 'vcr_cassettes'
end
@@ -22,7 +22,7 @@ Feature: EM HTTP Request
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with :webmock
c.cassette_library_dir = 'cassettes'
end
@@ -24,7 +24,7 @@ Feature: Net::HTTP
"""ruby
require 'vcr_setup.rb'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -50,7 +50,7 @@ Feature: Net::HTTP
"""ruby
require 'vcr_setup.rb'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -82,7 +82,7 @@ Feature: Net::HTTP
"""ruby
require 'vcr_setup.rb'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -115,7 +115,7 @@ Feature: Net::HTTP
require 'open-uri'
require 'vcr_setup.rb'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -141,7 +141,7 @@ Feature: Net::HTTP
"""ruby
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.stub_with <stub_with>
c.cassette_library_dir = 'cassettes'
end
@@ -22,7 +22,7 @@ Feature: Faraday middleware
require 'vcr'
- VCR.config do |c|
+ VCR.configure do |c|
c.cassette_library_dir = 'cassettes'
c.stub_with :faraday
end
Oops, something went wrong.

0 comments on commit e36ed0e

Please sign in to comment.