class My
def self.blabla(url)
open(url) {|f| #processing
}
end
end
open is Kernel method. How do I mock it? Kernel.expects and
Kernel.should_receive and Kernel.stub! do no good.
To make it more clear, I am looking for something like this:
it “should processing rails.com” do
Kernel.expects(:open).with(‘rails.com’).returns(‘blue’)
My.blabla(‘rails.com’).should == ‘result of self.blabla’
end
open is Kernel method. How do I mock it? Kernel.expects and
Kernel.should_receive and Kernel.stub! do no good.
To make it more clear, I am looking for something like this:
it “should processing rails.com” do
Kernel.expects(:open).with(‘rails.com’).returns(‘blue’)
My.blabla(‘rails.com’).should == ‘result of self.blabla’
end
I don’t know if it’s the same, but with Mocha you can do…