spec/unit/wgif/downloader_spec.rb in wgif-0.5.2 vs spec/unit/wgif/downloader_spec.rb in wgif-0.5.3
- old
+ new
@@ -21,10 +21,13 @@
expect(downloader.video_id clip_url).to eq('roflcopter')
end
it 'throws an error if the video is not found' do
expect(ViddlRb).to receive(:get_urls).with(clip_url)
- .and_return(['http://lol.wut'])
+ .and_return(['not a url'])
+ fake_response = double(response_code: 404)
+ fake_request = double(run: fake_response).as_null_object
+ allow(Typhoeus::Request).to receive(:new).and_return(fake_request)
expect { downloader.get_video(clip_url) }
.to raise_error(WGif::VideoNotFoundException)
end
it 'extracts a YouTube ID from a URL' do