Skip to content

How to stub Screencap in Rspec #14

@snoblenet

Description

@snoblenet

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions