To mock or stub ‘open’ method Posted on December 16, 2009 by Yang Chung Don’t fool with Kernel call. Just use OpenURI.open_uri. OpenURI.expects(:open_uri).returns("some content")
OpenURI.expects(:open_uri).returns( StringIO.new(‘{“name”:”Foo”}’) )