Questions tagged [vcr]

VCR is a ruby tool that facilitates testing HTTP-dependent code by recording HTTP interactions for future playback.

For more information: https://github.com/vcr/vcr

178 questions
0
votes
2 answers

Rspec VCR and custom response

Suppose, I have a request to google.com. I can record a cassette and use. But imagine situation when I need to test suite when google.com returns a 500 error code? How could it be done? I thought about manual change of the cassette file, but when I…
hasrthur
  • 1,410
  • 15
  • 31
0
votes
1 answer

VCR auto-rerecord not rerecording after first interval

I have a problem with auto rerecording of cassettes in vcr This is my config: VCR.configure do |c| c.cassette_library_dir = 'spec/support/vcr_cassettes' c.hook_into :fakeweb end and the call: VCR.use_cassette 'my_cassette', :re_record_interval…
Headshota
  • 21,021
  • 11
  • 61
  • 82
0
votes
0 answers

VCR's allow_playback_repeat option does not let me reuse old cassettes

I have a test that implements VCR as follows: describe "DELETE destroy" do context 'for an Item that can be deleted' do it "destroys the requested item, assigns a flash message, and redirects to the items list" do …
Eric Baldwin
  • 3,341
  • 10
  • 31
  • 71
0
votes
1 answer

Let VCR skips URI :

I neet VCR to skip just https://api.github.com/users/lapaty/starred calling the real external API, while going on mocking similar path like https://api.github.com/repos/lgs/elasticrepo Until now I tried the followings, without any success…
Luca G. Soave
  • 12,271
  • 12
  • 58
  • 109
0
votes
1 answer

VCR fails with DB (cassettes table doesn't exist) error when running tests

While using VCR with my Rails 3.1 app on Ruby 1.9, running rake test with an existing cassette produces: Error: test_#create_returns_created_account_upon_successful_creation(AccountServiceTest) ActiveRecord::StatementInvalid: Mysql2::Error:…
Eric Wendelin
  • 43,147
  • 9
  • 68
  • 92
0
votes
1 answer

VCR Sharing requests between cassettes?

My VCR config is: VCR.configure do |c| c.configure_rspec_metadata! c.cassette_library_dir = 'spec/cassettes' c.hook_into :webmock c.ignore_localhost = true end And a test example is: it "creates a build", :vcr => {:cassette_name =>…
Jay Truluck
  • 1,509
  • 10
  • 17
0
votes
1 answer

RSpec tests for Evernote API

I have a Rails app that makes calls to the Evernote API. I want to write RSpec tests for these calls. What's the best way of doing that? I know I can use Webmock or VCR, but - unless I'm mistaken - I would not then be able to have self-contained…
Joe Gatt
  • 2,197
  • 3
  • 15
  • 19
0
votes
2 answers

how to test bad network connection with rspec

I'd like to test for connection errors to an external api. What is the best way to go about and do this? in my controller i have begin result = connect.to_api rescue Error::TooManyRequests => e flash = e end I'd like to test that the error gets…
montrealmike
  • 11,433
  • 10
  • 64
  • 86
0
votes
1 answer

test failure when using VCR with paperclip

I have a test that works, and passes, the first time but fails the second time the spec suite is run: VCR.use_cassette("master_image_create_2", :match_requests_on => [:method, :uri]) do mi = Factory.build(:master_asset) img = File.new(…
brycemcd
  • 4,343
  • 3
  • 26
  • 29
-1
votes
1 answer

Is it possible to use VCR gem in Ruby to record an outgoing message and expect that the correct message is sent?

This would be the same functionality as Webmock. Except it would take a cassette instead of a string. Something like expect(Webmock)to receive...
B Seven
  • 44,484
  • 66
  • 240
  • 385
-1
votes
1 answer

Does vcrpy's record_mode=None guarantee no HTTP requests will be sent even if the requests are made in a thread?

I am testing some code with pytest and using the vcrpy decorator as follows: @pytest.mark.vcr(record_mode='none') def test_something(): make_requests_in_a_thread_and_save_to_queue() logged_responses = log_responses_from_queue_in_a_thread() …
numberwang
  • 39
  • 5
-1
votes
1 answer

What service should I use for changing coupon status in VCR and EMD?

I have vcr and EMD. All ones have coupon status OK. I need to change it on EXCH. There is a commands VCRSTATUS/C1/TO-EXCH-REF TO MCO0010010111222 WEMDSTATUS/C1/TO-EXCH-REF TO MCO0010010111222 but it doesn't work in SabreCommand …
-2
votes
1 answer

Testing HTML parser

I am trying to implement some tests for HTML parser written on ruby and using Nokogiri for parsing, it gets it's response from some http request. Currently the test uses a fixture (html file that is saved). but the problem is that from time to time…
Headshota
  • 21,021
  • 11
  • 61
  • 82
1 2 3
11
12