I have couple of tests inside which I have before and after blocks to save and eject HTTP calls using VCR gem:
describe "story" do
before do
VCR.insert_cassette 'story', :record => :new_episodes
end
after do
VCR.eject_cassette
end
......
end
I have repeated this inside other test blocks, each time calling VCR.insert_cassette, with a different parameter (ex. ‘comments’). what is the best way to refactor this code in order to extract the before and after calls ?
you can access the source file on github