Skip to content

Instantly share code, notes, and snippets.

@JEG2
Created November 13, 2012 15:22
Show Gist options
  • Select an option

  • Save JEG2/4066291 to your computer and use it in GitHub Desktop.

Select an option

Save JEG2/4066291 to your computer and use it in GitHub Desktop.
Another Typhoeus VCR failure
gem "typhoeus", git: "https://github.com/typhoeus/typhoeus.git",
ref: "8e815cdf4fed2322947e2338d6f5b084c820a70b"
gem "vcr"
gem "rspec"
require "bundler/setup"
require "typhoeus"
require "vcr"
VCR.configure do |config|
config.cassette_library_dir = "vcr_cassettes"
config.hook_into :typhoeus
end
describe VCR do
it "should work with callbacks registered after the request is queued" do
VCR.use_cassette("late_callbacks") do
hydra = Typhoeus::Hydra.new
request = Typhoeus::Request.new("http://xkcd.com/")
success = false
hydra.queue(request)
request.on_success do |_|
success = true
end
hydra.run
expect(success).to be_true
end
end
end
# $ rspec vcr_spec.rb
# .
#
# Finished in 0.21526 seconds
# 1 example, 0 failures
# $ rspec vcr_spec.rb
# F
#
# Failures:
#
# 1) VCR should work with callbacks registered after the request is queued
# Failure/Error: expect(success).to be_true
# expected: true value
# got: false
# # ./vcr_spec.rb:23:in `block (3 levels) in <top (required)>'
# # ./vcr_spec.rb:12:in `block (2 levels) in <top (required)>'
#
# Finished in 0.0094 seconds
# 1 example, 1 failure
#
# Failed examples:
#
# rspec ./vcr_spec.rb:11 # VCR should work with callbacks registered after the request is queued
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment