screencap
screencap copied to clipboard
How to stub Screencap in Rspec
I've tried numerous variations:
require 'screencap'
...and then each of the following:
Screencap.any_instance.stub(:fetch).and_return(File.open("#{Rails.root}/spec/support/stubbed_image.png"))
Fetcher::Screencap.any_instance.stub(:fetch).and_return(File.open("#{Rails.root}/spec/support/stubbed_image.png"))
Screencap.stub(:fetch).and_return(File.open("#{Rails.root}/spec/support/stubbed_image.png"))
Fetcher::Screencap(:fetch).and_return(File.open("#{Rails.root}/spec/support/stubbed_image.png"))
But I get various errors saying the various Rspec stubbing methods I require are not defined.