Created
November 12, 2012 18:45
-
-
Save JEG2/4061104 to your computer and use it in GitHub Desktop.
The problem I'm having getting Typhoeus and VCR to cooperate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 a queue" do | |
| VCR.use_cassette("test") do | |
| hydra = Typhoeus::Hydra.new | |
| request = Typhoeus::Request.new("http://xkcd.com/") | |
| success = false | |
| request.on_success do |_| | |
| success = true | |
| end | |
| hydra.queue(request) | |
| hydra.run | |
| expect(success).to be_true | |
| end | |
| end | |
| end | |
| # $ rspec vcr_spec.rb | |
| # . | |
| # Finished in 1.19 seconds | |
| # 1 example, 0 failures | |
| # $ rspec vcr_spec.rb | |
| # F | |
| # Failures: | |
| # 1) VCR should work with a queue | |
| # Failure/Error: expect(success).to be_true | |
| # expected: true value | |
| # got: false | |
| # # ./vcr_spec.rb:22:in `block (3 levels) in <top (required)>' | |
| # # ./vcr_spec.rb:11:in `block (2 levels) in <top (required)>' | |
| # Finished in 0.05077 seconds | |
| # 1 example, 1 failure | |
| # Failed examples: | |
| # rspec ./vcr_spec.rb:10 # VCR should work with a queue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment