In the situation below the @crawl object DOES RECEIVE the crawl call, but the method mock fails ie: the method is not mocked.
Does Thread somehow create its own copy of the @crawl object escaping the mock?
@crawl.should_receive(:crawl).with(an_instance_of(String)).twice.and_return(nil)
threads = @crawl.create_threads
thread creation code:
def crawl(uri)
dosomecrawling
end
def create_threads
(1..5).each do
Thread.new do
crawl(someurifeedingmethod)
end
end
end