screencap icon indicating copy to clipboard operation
screencap copied to clipboard

How to stub Screencap in Rspec

Open snoblenet opened this issue 10 years ago • 0 comments

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.

snoblenet avatar Nov 10 '14 23:11 snoblenet