search for: bad_response

Displaying 1 result from an estimated 1 matches for "bad_response".

Did you mean: a_response
2008 May 03
5
Need some help in reducing my repetions in tests with Mocha
...thod which will insert my changing block into the middle of the expectation call. Well, I have a prototype method: def web_stub(good=true,&block) http = mock() http.stubs(:use_ssl=) get = http.expects(:get) if block_given? get = yield get end get.returns(good ? good_response : bad_response) Net::HTTP.stubs(:new).returns(http) end But this requires me to use the very ugly syntax of web_stub do |get| get.with do |url| url.split("?",2).first =~ /query$/ end end And I''d like to avoid the need for nested blocks if possible. Any pointers on how to implemen...