Mock Kernel method

I use rspec on rails. I want to test model.

My model has this method:

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

I don't know if it's the same, but with Mocha you can do...

  My.expects(:open).with('rails.com').returns('blue')

I hope that helps.

Yes, I have tried that in simple unit testing file. It works, but I can not figure out integrate that with rspec on rails even using mocha.

Strange. Have you tried the rspec mailing list [1]?

Not yet. Maybe I should.