10 tips to help using the VCR gem in your Ruby test suite

The original post, in Portuguese, was published here. (I procrastinated to translate it to English almost 1 year!)The gem VCR is a good choice to do integrated tests in Ruby apps. It can be used in other languages too, but it will be not covered in this post.It let us automate the process of stubbing the web requests through the gem Webmock (or other similar). In order to do it, it records cassette files with all the HTTP requests and responses to external APIs. By doing this, it allows us to execute the test suite fastly and not depending on their state and disponibility of these APIs.However, when a test suite starts to get bigger, it is necessary to care about some things to help on the maintenance and avoid turning into a nightmare.I will list some tips and tricks to accomplish it.The examples are using the gem rspec in a rails project, but VCR can be used with other frameworks, like sinatra with minitest.
10 tips to help using the VCR gem in your Ruby test suite #ruby #rails #rubyonrails #bosnia #programming #tutorials #rubydeveloper #railsdeveloper

Nezir Zahirovic

Freelance software developer Ruby On Rails (4 years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles