How to use interaction method of VCR Package

Best Vcr_ruby code snippet using VCR.interaction

cassette_spec.rb

Source:cassette_spec.rb Github

copy

Full Screen

1require 'spec_helper'2describe VCR::Cassette do3 def http_interaction4 request = VCR::Request.new(:get)5 response = VCR::Response.new6 response.status = VCR::ResponseStatus.new7 VCR::HTTPInteraction.new(request, response).tap { |i| yield i if block_given? }8 end9 def stub_old_interactions(interactions)10 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"11 hashes = interactions.map(&:to_hash)12 allow(VCR.cassette_serializers[:yaml]).to receive(:deserialize).and_return({ 'http_interactions' => hashes })13 allow(VCR::HTTPInteraction).to receive(:from_hash) do |hash|14 interactions[hashes.index(hash)]15 end16 end17 describe '#file' do18 it 'delegates the file resolution to the FileSystem persister' do19 fs = VCR::Cassette::Persisters::FileSystem20 expect(fs).to respond_to(:absolute_path_to_file).with(1).argument21 expect(fs).to receive(:absolute_path_to_file).with("cassette name.yml") { "f.yml" }22 expect(VCR::Cassette.new("cassette name").file).to eq("f.yml")23 end24 it 'raises a NotImplementedError when a different persister is used' do25 VCR.cassette_persisters[:a] = double26 cassette = VCR::Cassette.new("f", :persist_with => :a)27 expect { cassette.file }.to raise_error(NotImplementedError)28 end29 end30 describe '#tags' do31 it 'returns a blank array if no tag has been set' do32 expect(VCR::Cassette.new("name").tags).to eq([])33 end34 it 'converts a single :tag to an array' do35 expect(VCR::Cassette.new("name", :tag => :foo).tags).to eq([:foo])36 end37 it 'accepts an array as the :tags option' do38 expect(VCR::Cassette.new("name", :tags => [:foo]).tags).to eq([:foo])39 end40 end41 describe '#record_http_interaction' do42 let(:the_interaction) { double(:request => double(:method => :get).as_null_object).as_null_object }43 it 'adds the interaction to #new_recorded_interactions' do44 cassette = VCR::Cassette.new(:test_cassette)45 expect(cassette.new_recorded_interactions).to eq([])46 cassette.record_http_interaction(the_interaction)47 expect(cassette.new_recorded_interactions).to eq([the_interaction])48 end49 end50 describe "#serializable_hash" do51 subject { VCR::Cassette.new("foo") }52 let(:interaction_1) { http_interaction { |i| i.request.body = 'req body 1'; i.response.body = 'res body 1' } }53 let(:interaction_2) { http_interaction { |i| i.request.body = 'req body 2'; i.response.body = 'res body 2' } }54 let(:interactions) { [interaction_1, interaction_2] }55 before(:each) do56 interactions.each do |i|57 subject.record_http_interaction(i)58 end59 end60 let(:metadata) { subject.serializable_hash.reject { |k,v| k == "http_interactions" } }61 it 'includes the hash form of all recorded interactions' do62 allow(interaction_1).to receive(:to_hash).and_return({ "i" => 1, 'body' => '' })63 allow(interaction_2).to receive(:to_hash).and_return({ "i" => 2, 'body' => '' })64 expect(subject.serializable_hash).to include('http_interactions' => [{ "i" => 1, 'body' => '' }, { "i" => 2, 'body' => '' }])65 end66 it 'includes additional metadata about the cassette' do67 expect(metadata).to eq("recorded_with" => "VCR #{VCR.version}")68 end69 end70 describe "#recording?" do71 [:all, :new_episodes].each do |mode|72 it "returns true when the record mode is :#{mode}" do73 cassette = VCR::Cassette.new("foo", :record => mode)74 expect(cassette).to be_recording75 end76 end77 it "returns false when the record mode is :none" do78 cassette = VCR::Cassette.new("foo", :record => :none)79 expect(cassette).not_to be_recording80 end81 context 'when the record mode is :once' do82 before(:each) do83 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"84 end85 it 'returns false when there is an existing cassette file with content' do86 cassette = VCR::Cassette.new("example", :record => :once)87 expect(File).to exist(cassette.file)88 expect(File.size?(cassette.file)).to be_truthy89 expect(cassette).not_to be_recording90 end91 it 'returns true when there is an empty existing cassette file' do92 cassette = VCR::Cassette.new("empty", :record => :once)93 expect(File).to exist(cassette.file)94 expect(File.size?(cassette.file)).to be_falsey95 expect(cassette).to be_recording96 end97 it 'returns true when there is no existing cassette file' do98 cassette = VCR::Cassette.new("non_existant_file", :record => :once)99 expect(File).not_to exist(cassette.file)100 expect(cassette).to be_recording101 end102 end103 end104 describe '#match_requests_on' do105 before(:each) { VCR.configuration.default_cassette_options.merge!(:match_requests_on => [:uri, :method]) }106 it "returns the provided options" do107 c = VCR::Cassette.new('example', :match_requests_on => [:uri])108 expect(c.match_requests_on).to eq([:uri])109 end110 it "returns a the default #match_requests_on when it has not been specified for the cassette" do111 c = VCR::Cassette.new('example')112 expect(c.match_requests_on).to eq([:uri, :method])113 end114 end115 describe "reading the file from disk" do116 let(:empty_cassette_yaml) { YAML.dump("http_interactions" => []) }117 it 'optionally renders the file as ERB using the ERBRenderer' do118 allow(VCR::Cassette::Persisters::FileSystem).to receive(:[]).and_return(empty_cassette_yaml)119 expect(VCR::Cassette::ERBRenderer).to receive(:new).with(120 empty_cassette_yaml, anything, "foo"121 ).and_return(double('renderer', :render => empty_cassette_yaml))122 VCR::Cassette.new('foo', :record => :new_episodes).http_interactions123 end124 [true, false, nil, { }].each do |erb|125 it "passes #{erb.inspect} to the VCR::Cassette::ERBRenderer when given as the :erb option" do126 # test that it overrides the default127 VCR.configuration.default_cassette_options = { :erb => true }128 expect(VCR::Cassette::ERBRenderer).to receive(:new).with(129 anything, erb, anything130 ).and_return(double('renderer', :render => empty_cassette_yaml))131 VCR::Cassette.new('foo', :record => :new_episodes, :erb => erb).http_interactions132 end133 it "passes #{erb.inspect} to the VCR::Cassette::ERBRenderer when it is the default :erb option and none is given" do134 VCR.configuration.default_cassette_options = { :erb => erb }135 expect(VCR::Cassette::ERBRenderer).to receive(:new).with(136 anything, erb, anything137 ).and_return(double('renderer', :render => empty_cassette_yaml))138 VCR::Cassette.new('foo', :record => :new_episodes).http_interactions139 end140 end141 it 'raises a friendly error when the cassette file is in the old VCR 1.x format' do142 VCR.configuration.cassette_library_dir = 'spec/fixtures/cassette_spec'143 expect {144 VCR::Cassette.new('1_x_cassette').http_interactions145 }.to raise_error(VCR::Errors::InvalidCassetteFormatError)146 end147 end148 describe '.new' do149 it "raises an error if given an invalid record mode" do150 expect { VCR::Cassette.new(:test, :record => :not_a_record_mode) }.to raise_error(ArgumentError)151 end152 it 'raises an error if given invalid options' do153 expect {154 VCR::Cassette.new(:test, :invalid => :option)155 }.to raise_error(ArgumentError)156 end157 it 'does not raise an error in the case of an empty file' do158 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"159 expect(VCR::Cassette.new('empty', :record => :none).send(:previously_recorded_interactions)).to eq([])160 end161 let(:custom_persister) { double("custom persister") }162 it 'reads from the configured persister' do163 VCR.configuration.cassette_library_dir = nil164 VCR.cassette_persisters[:foo] = custom_persister165 expect(custom_persister).to receive(:[]).with("abc.yml") { "" }166 VCR::Cassette.new("abc", :persist_with => :foo).http_interactions167 end168 VCR::Cassette::VALID_RECORD_MODES.each do |record_mode|169 stub_requests = (record_mode != :all)170 context "when VCR.configuration.default_cassette_options[:record] is :#{record_mode}" do171 before(:each) { VCR.configuration.default_cassette_options = { :record => record_mode } }172 it "defaults the record mode to #{record_mode} when VCR.configuration.default_cassette_options[:record] is #{record_mode}" do173 cassette = VCR::Cassette.new(:test)174 expect(cassette.record_mode).to eq(record_mode)175 end176 end177 context "when :#{record_mode} is passed as the record option" do178 unless record_mode == :all179 let(:interaction_1) { http_interaction { |i| i.request.uri = 'http://example.com/foo' } }180 let(:interaction_2) { http_interaction { |i| i.request.uri = 'http://example.com/bar' } }181 let(:interactions) { [interaction_1, interaction_2] }182 it 'updates the content_length headers when given :update_content_length_header => true' do183 stub_old_interactions(interactions)184 expect(interaction_1.response).to receive(:update_content_length_header)185 expect(interaction_2.response).to receive(:update_content_length_header)186 VCR::Cassette.new('example', :record => record_mode, :update_content_length_header => true).http_interactions187 end188 [nil, false].each do |val|189 it "does not update the content_lenth headers when given :update_content_length_header => #{val.inspect}" do190 stub_old_interactions(interactions)191 expect(interaction_1.response).not_to receive(:update_content_length_header)192 expect(interaction_2.response).not_to receive(:update_content_length_header)193 VCR::Cassette.new('example', :record => record_mode, :update_content_length_header => val).http_interactions194 end195 end196 context "and re_record_interval is 7.days" do197 let(:file_name) { File.join(VCR.configuration.cassette_library_dir, "cassette_name.yml") }198 subject { VCR::Cassette.new(File.basename(file_name).gsub('.yml', ''), :record => record_mode, :re_record_interval => 7.days) }199 context 'when the cassette file does not exist' do200 before(:each) { allow(File).to receive(:exist?).with(file_name).and_return(false) }201 it "has :#{record_mode} for the record mode" do202 expect(subject.record_mode).to eq(record_mode)203 end204 end205 context 'when the cassette file does exist' do206 before(:each) do207 interactions = timestamps.map do |ts|208 http_interaction { |i| i.recorded_at = ts }.to_hash209 end210 yaml = YAML.dump("http_interactions" => interactions)211 allow(File).to receive(:exist?).with(file_name).and_return(true)212 allow(File).to receive(:size?).with(file_name).and_return(true)213 allow(File).to receive(:read).with(file_name).and_return(yaml)214 end215 context 'and the earliest recorded interaction was recorded less than 7 days ago' do216 let(:timestamps) do [217 Time.now - 6.days + 60,218 Time.now - 7.days + 60,219 Time.now - 5.days + 60220 ] end221 it "has :#{record_mode} for the record mode" do222 expect(subject.record_mode).to eq(record_mode)223 end224 end225 context 'and the earliest recorded interaction was recorded more than 7 days ago' do226 let(:timestamps) do [227 Time.now - 6.days - 60,228 Time.now - 7.days - 60,229 Time.now - 5.days - 60230 ] end231 it "has :all for the record mode when there is an internet connection available" do232 allow(VCR::InternetConnection).to receive(:available?).and_return(true)233 expect(subject.record_mode).to eq(:all)234 end235 it "has :#{record_mode} for the record mode when there is no internet connection available" do236 allow(VCR::InternetConnection).to receive(:available?).and_return(false)237 expect(subject.record_mode).to eq(record_mode)238 end239 end240 end241 end242 end243 it 'does not load ignored interactions' do244 allow(VCR.request_ignorer).to receive(:ignore?) do |request|245 request.uri !~ /example\.com/246 end247 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"248 cassette = VCR::Cassette.new('with_localhost_requests', :record => record_mode)249 expect(cassette.send(:previously_recorded_interactions).map { |i| URI.parse(i.request.uri).host }).to eq(%w[example.com])250 end251 it "loads the recorded interactions from the library yml file" do252 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"253 cassette = VCR::Cassette.new('example', :record => record_mode)254 expect(cassette.send(:previously_recorded_interactions).size).to eq(3)255 i1, i2, i3 = *cassette.send(:previously_recorded_interactions)256 expect(i1.request.method).to eq(:get)257 expect(i1.request.uri).to eq('http://example.com/')258 expect(i1.response.body).to match(/You have reached this web page by typing.+example\.com/)259 expect(i2.request.method).to eq(:get)260 expect(i2.request.uri).to eq('http://example.com/foo')261 expect(i2.response.body).to match(/foo was not found on this server/)262 expect(i3.request.method).to eq(:get)263 expect(i3.request.uri).to eq('http://example.com/')264 expect(i3.response.body).to match(/Another example\.com response/)265 end266 [true, false].each do |value|267 it "instantiates the http_interactions with allow_playback_repeats = #{value} if given :allow_playback_repeats => #{value}" do268 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"269 cassette = VCR::Cassette.new('example', :record => record_mode, :allow_playback_repeats => value)270 expect(cassette.http_interactions.allow_playback_repeats).to eq(value)271 end272 end273 it "instantiates the http_interactions with parent_list set to a null list if given :exclusive => true" do274 allow(VCR).to receive(:http_interactions).and_return(double)275 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"276 cassette = VCR::Cassette.new('example', :record => record_mode, :exclusive => true)277 expect(cassette.http_interactions.parent_list).to be(VCR::Cassette::HTTPInteractionList::NullList)278 end279 it "instantiates the http_interactions with parent_list set to VCR.http_interactions if given :exclusive => false" do280 allow(VCR).to receive(:http_interactions).and_return(double)281 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"282 cassette = VCR::Cassette.new('example', :record => record_mode, :exclusive => false)283 expect(cassette.http_interactions.parent_list).to be(VCR.http_interactions)284 end285 if stub_requests286 it 'invokes the before_playback hooks' do287 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"288 expect(VCR.configuration).to receive(:invoke_hook).with(289 :before_playback,290 an_instance_of(VCR::HTTPInteraction::HookAware),291 an_instance_of(VCR::Cassette)292 ).exactly(3).times293 cassette = VCR::Cassette.new('example', :record => record_mode)294 expect(cassette.send(:previously_recorded_interactions).size).to eq(3)295 end296 it 'does not playback any interactions that are ignored in a before_playback hook' do297 VCR.configure do |c|298 c.before_playback { |i| i.ignore! if i.request.uri =~ /foo/ }299 end300 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"301 cassette = VCR::Cassette.new('example', :record => record_mode)302 expect(cassette.send(:previously_recorded_interactions).size).to eq(2)303 end304 it 'instantiates the http_interactions with the loaded interactions and the request matchers' do305 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"306 cassette = VCR::Cassette.new('example', :record => record_mode, :match_requests_on => [:body, :headers])307 expect(cassette.http_interactions.interactions.size).to eq(3)308 expect(cassette.http_interactions.request_matchers).to eq([:body, :headers])309 end310 else311 it 'instantiates the http_interactions with the no interactions and the request matchers' do312 VCR.configuration.cassette_library_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"313 cassette = VCR::Cassette.new('example', :record => record_mode, :match_requests_on => [:body, :headers])314 expect(cassette.http_interactions.interactions.size).to eq(0)315 expect(cassette.http_interactions.request_matchers).to eq([:body, :headers])316 end317 end318 end319 end320 end321 describe ".originally_recorded_at" do322 it 'returns the earliest `recorded_at` timestamp' do323 i1 = http_interaction { |i| i.recorded_at = Time.now - 1000 }324 i2 = http_interaction { |i| i.recorded_at = Time.now - 10000 }325 i3 = http_interaction { |i| i.recorded_at = Time.now - 100 }326 stub_old_interactions([i1, i2, i3])327 cassette = VCR::Cassette.new("example")328 expect(cassette.originally_recorded_at).to eq(i2.recorded_at)329 end330 it 'records nil for a cassette that has no prior recorded interactions' do331 stub_old_interactions([])332 cassette = VCR::Cassette.new("example")333 expect(cassette.originally_recorded_at).to be_nil334 end335 end336 describe '#eject' do337 let(:custom_persister) { double("custom persister", :[] => nil) }338 context "when :allow_unused_http_interactions is set to false" do339 it 'asserts that there are no unused interactions' do340 cassette = VCR.insert_cassette("foo", :allow_unused_http_interactions => false)341 interaction_list = cassette.http_interactions342 expect(interaction_list).to respond_to(:assert_no_unused_interactions!).with(0).arguments343 expect(interaction_list).to receive(:assert_no_unused_interactions!)344 cassette.eject345 end346 it 'does not assert no unused interactions if there is an existing error' do347 cassette = VCR.insert_cassette("foo", :allow_unused_http_interactions => false)348 interaction_list = cassette.http_interactions349 allow(interaction_list).to receive(:assert_no_unused_interactions!)350 expect {351 begin352 raise "boom"353 ensure354 cassette.eject355 end356 }.to raise_error(/boom/)357 expect(interaction_list).not_to have_received(:assert_no_unused_interactions!)358 end359 it 'does not assert no unused interactions if :skip_no_unused_interactions_assertion is passed' do360 cassette = VCR.insert_cassette("foo", :allow_unused_http_interactions => false)361 interaction_list = cassette.http_interactions362 expect(interaction_list).not_to receive(:assert_no_unused_interactions!)363 cassette.eject(:skip_no_unused_interactions_assertion => true)364 end365 end366 it 'does not assert that there are no unused interactions if allow_unused_http_interactions is set to true' do367 cassette = VCR.insert_cassette("foo", :allow_unused_http_interactions => true)368 interaction_list = cassette.http_interactions369 expect(interaction_list).to respond_to(:assert_no_unused_interactions!)370 expect(interaction_list).not_to receive(:assert_no_unused_interactions!)371 cassette.eject372 end373 it 'stores the cassette content using the configured persister' do374 VCR.configuration.cassette_library_dir = nil375 VCR.cassette_persisters[:foo] = custom_persister376 cassette = VCR.insert_cassette("foo", :persist_with => :foo)377 cassette.record_http_interaction http_interaction378 expect(custom_persister).to receive(:[]=).with("foo.yml", /http_interactions/)379 cassette.eject380 end381 it "writes the serializable_hash to disk as yaml" do382 cassette = VCR::Cassette.new(:eject_test)383 cassette.record_http_interaction http_interaction # so it has one384 expect(cassette).to respond_to(:serializable_hash)385 allow(cassette).to receive(:serializable_hash).and_return({ "http_interactions" => [1, 3, 5] })386 expect { cassette.eject }.to change { File.exist?(cassette.file) }.from(false).to(true)387 saved_stuff = YAML.load_file(cassette.file)388 expect(saved_stuff).to eq("http_interactions" => [1, 3, 5])389 end390 it 'invokes the appropriately tagged before_record hooks' do391 interactions = [392 http_interaction { |i| i.request.uri = 'http://foo.com/'; i.response.body = 'res 1' },393 http_interaction { |i| i.request.uri = 'http://bar.com/'; i.response.body = 'res 2' }394 ]395 cassette = VCR::Cassette.new('example', :tag => :foo)396 allow(cassette).to receive(:new_recorded_interactions).and_return(interactions)397 allow(VCR.configuration).to receive(:invoke_hook).and_return([false])398 interactions.each do |i|399 expect(VCR.configuration).to receive(:invoke_hook).with(400 :before_record,401 an_instance_of(VCR::HTTPInteraction::HookAware),402 cassette403 ).ordered404 end405 cassette.eject406 end407 it 'does not record interactions that have been ignored' do408 interaction_1 = http_interaction { |i| i.request.uri = 'http://foo.com/'; i.response.body = 'res 1' }409 interaction_2 = http_interaction { |i| i.request.uri = 'http://bar.com/'; i.response.body = 'res 2' }410 hook_aware_interaction_1 = interaction_1.hook_aware411 allow(interaction_1).to receive(:hook_aware).and_return(hook_aware_interaction_1)412 hook_aware_interaction_1.ignore!413 cassette = VCR::Cassette.new('test_cassette')414 allow(cassette).to receive(:new_recorded_interactions).and_return([interaction_1, interaction_2])415 cassette.eject416 saved_recorded_interactions = ::YAML.load_file(cassette.file)417 expect(saved_recorded_interactions["http_interactions"]).to eq([interaction_2.to_hash])418 end419 it 'does not write the cassette to disk if all interactions have been ignored' do420 interaction_1 = http_interaction { |i| i.request.uri = 'http://foo.com/'; i.response.body = 'res 1' }421 hook_aware_interaction_1 = interaction_1.hook_aware422 allow(interaction_1).to receive(:hook_aware).and_return(hook_aware_interaction_1)423 hook_aware_interaction_1.ignore!424 cassette = VCR::Cassette.new('test_cassette')425 allow(cassette).to receive(:new_recorded_interactions).and_return([interaction_1])426 cassette.eject427 expect(File).not_to exist(cassette.file)428 end429 it "writes the recorded interactions to a subdirectory if the cassette name includes a directory" do430 recorded_interactions = [http_interaction { |i| i.response.body = "subdirectory response" }]431 cassette = VCR::Cassette.new('subdirectory/test_cassette')432 allow(cassette).to receive(:new_recorded_interactions).and_return(recorded_interactions)433 expect { cassette.eject }.to change { File.exist?(cassette.file) }.from(false).to(true)434 saved_recorded_interactions = YAML.load_file(cassette.file)435 expect(saved_recorded_interactions["http_interactions"]).to eq(recorded_interactions.map(&:to_hash))436 end437 [:all, :none, :new_episodes].each do |record_mode|438 context "for a :record => :#{record_mode} cassette with previously recorded interactions" do439 subject { VCR::Cassette.new('example', :record => record_mode, :match_requests_on => [:uri]) }440 before(:each) do441 base_dir = "#{VCR::SPEC_ROOT}/fixtures/cassette_spec"442 FileUtils.cp(base_dir + "/example.yml", VCR.configuration.cassette_library_dir + "/example.yml")443 end444 it "does not re-write to disk the previously recorded interactions if there are no new ones" do445 yaml_file = subject.file446 expect(File).not_to receive(:open).with(subject.file, 'w')447 expect { subject.eject }.to_not change { File.mtime(yaml_file) }448 end449 context 'when some new interactions have been recorded' do450 def interaction(response_body, request_attributes)451 http_interaction do |interaction|452 interaction.response.body = response_body453 request_attributes.each do |key, value|454 interaction.request.send("#{key}=", value)455 end456 end457 end458 let(:interaction_foo_1) { interaction("foo 1", :uri => 'http://foo.com/') }459 let(:interaction_foo_2) { interaction("foo 2", :uri => 'http://foo.com/') }460 let(:interaction_bar) { interaction("bar", :uri => 'http://bar.com/') }461 let(:saved_recorded_interactions) { YAML.load_file(subject.file)['http_interactions'].map { |h| VCR::HTTPInteraction.from_hash(h) } }462 let(:now) { Time.utc(2011, 6, 11, 12, 30) }463 before(:each) do464 allow(Time).to receive(:now).and_return(now)465 allow(subject).to receive(:previously_recorded_interactions).and_return([interaction_foo_1])466 subject.record_http_interaction(interaction_foo_2)467 subject.record_http_interaction(interaction_bar)468 subject.eject469 end470 if record_mode == :all471 it 'replaces previously recorded interactions with new ones when the requests match' do472 expect(saved_recorded_interactions.first).to eq(interaction_foo_2)473 expect(saved_recorded_interactions).not_to include(interaction_foo_1)474 end475 it 'appends new recorded interactions that do not match existing ones' do476 expect(saved_recorded_interactions.last).to eq(interaction_bar)477 end478 else479 it 'appends new recorded interactions after existing ones' do480 expect(saved_recorded_interactions).to eq([interaction_foo_1, interaction_foo_2, interaction_bar])481 end482 end483 end484 end485 end486 end487end...

Full Screen

Full Screen

interaction

Using AI Code Generation

copy

Full Screen

1VCR.use_cassette('test') do2Test.use_cassette('test') do3Test.use_cassette('test') do

Full Screen

Full Screen

interaction

Using AI Code Generation

copy

Full Screen

1VCR.use_cassette("github") do2VCR.use_cassette("github") do3VCR.use_cassette("github") do4VCR.use_cassette("github") do5VCR.use_cassette("github") do6VCR.use_cassette("github") do

Full Screen

Full Screen

interaction

Using AI Code Generation

copy

Full Screen

1 VCR.use_cassette("record_new") do2 response = Net::HTTP.get_response(URI.parse('http://www.google.com'))3 VCR.use_cassette("record_new") do4 response = Net::HTTP.get_response(URI.parse('http://www.google.com'))5 VCR.use_cassette("record_new") do6 response = Net::HTTP.get_response(URI.parse('http://www.google.com'))7 VCR.use_cassette("record_new") do8 response = Net::HTTP.get_response(URI.parse('http://www.google.com'))

Full Screen

Full Screen

interaction

Using AI Code Generation

copy

Full Screen

1VCR.use_cassette("test") do2VCR.use_cassette("test") do3 VCR.use_cassette("test") do4 VCR.use_cassette("test") do5 c.default_cassette_options = { :record => :new_episodes }6VCR.use_cassette("test") do7VCR.use_cassette("test") do

Full Screen

Full Screen

interaction

Using AI Code Generation

copy

Full Screen

1VCR.use_cassette('github') do2 puts HTTParty.get('https://api.github.com/users/andrew').body3VCR.use_cassette('github') do4 puts HTTParty.get('https://api.github.com/users/andrew').body5VCR.use_cassette('github') do6 puts HTTParty.get('https://api.github.com/users/andrew').body7VCR.use_cassette('github') do8 puts HTTParty.get('https://api.github.com/users/andrew').body9VCR.use_cassette('github') do10 puts HTTParty.get('https://api.github.com/users/andrew').body

Full Screen

Full Screen

interaction

Using AI Code Generation

copy

Full Screen

1VCR.use_cassette('github', :record => :new_episodes) do2 puts JSON.parse(response.body)3VCR.use_cassette('github', :record => :new_episodes) do4 puts JSON.parse(response.body)5VCR.use_cassette('github', :record => :new_episodes) do6 puts JSON.parse(response.body)

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Vcr_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful