Skip to content

Instantly share code, notes, and snippets.

@markiz
Created May 23, 2012 17:12
Embed
What would you like to do?
Test gist for vcr
source :rubygems
gem 'vcr', '2.1.1'
gem 'webmock', '1.8.6'
gem 'eventmachine', '1.0.0.beta.4'
gem 'em-http-request', '1.0.2'
gem 'rspec', '2.8.0'
GEM
remote: http://rubygems.org/
specs:
addressable (2.2.8)
cookiejar (0.3.0)
crack (0.3.1)
diff-lcs (1.1.3)
em-http-request (1.0.2)
addressable (>= 2.2.3)
cookiejar
em-socksify
eventmachine (>= 1.0.0.beta.4)
http_parser.rb (>= 0.5.3)
em-socksify (0.2.0)
eventmachine (>= 1.0.0.beta.4)
eventmachine (1.0.0.beta.4)
http_parser.rb (0.5.3)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
vcr (2.1.1)
webmock (1.8.6)
addressable (>= 2.2.7)
crack (>= 0.1.7)
PLATFORMS
ruby
DEPENDENCIES
em-http-request (= 1.0.2)
eventmachine (= 1.0.0.beta.4)
rspec (= 2.8.0)
vcr (= 2.1.1)
webmock (= 1.8.6)
require 'bundler/setup'
require 'rspec/autorun'
require 'vcr'
require 'webmock'
VCR.configure do |c|
c.cassette_library_dir = "vcr_cassettes"
c.hook_into :webmock
c.default_cassette_options = {
:record => :new_episodes,
:preserve_exact_body_bytes => true
}
end
describe VCR do
def http_get(url)
request = EM::HttpRequest.new(url).get({
:redirects => 15 # <- this line is responsible
})
request.errback { raise "Connection error @ #{url}" }
request
end
it "should work with multi-requests" do
VCR.use_cassette("issue-171-test") do
EM.run do
req = http_get("http://www.phpbb.com/community")
req.callback do
http_get("http://www.phpbb.com/community/viewforum.php?f=46").callback { EM.stop }
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment