Skip to content

Commit

Permalink
Use new github markdown syntax features.
Browse files Browse the repository at this point in the history
  • Loading branch information
myronmarston committed May 6, 2011
1 parent bdd8e95 commit aa61962
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ Record your test suite's HTTP interactions and replay them during future test ru

## Synopsis

require 'rubygems'
require 'test/unit'
require 'vcr'

VCR.config do |c|
c.cassette_library_dir = 'fixtures/vcr_cassettes'
c.stub_with :webmock # or :fakeweb
end

class VCRTest < Test::Unit::TestCase
def test_example_dot_com
VCR.use_cassette('synopsis') do
response = Net::HTTP.get_response(URI('http://www.iana.org/domains/example/'))
assert_match /Example Domains/, response.body
end
end
``` ruby
require 'rubygems'
require 'test/unit'
require 'vcr'

VCR.config do |c|
c.cassette_library_dir = 'fixtures/vcr_cassettes'
c.stub_with :webmock # or :fakeweb
end

class VCRTest < Test::Unit::TestCase
def test_example_dot_com
VCR.use_cassette('synopsis') do
response = Net::HTTP.get_response(URI('http://www.iana.org/domains/example/'))
assert_match /Example Domains/, response.body
end
end
end
```

Run this test once, and VCR will record the http request to `fixtures/vcr_cassettes/synopsis.yml`. Run it again, and VCR
will replay the response from iana.org when the http request is made. This test is now fast (no real HTTP requests are
Expand Down

0 comments on commit aa61962

Please sign in to comment.