0

The function fetch_details is called within the thread. It has a post request which raises the CustomError in case of failure. I need to test the CustomError without actually making the actual post request.

Thread.new {
      begin
        details = fetch_details(a, b)
        param1, param2 = parse_details(details, b)
        post_result("Success", url)
      rescue CustomError => e  
        post_result(e.message, url)
      end
    }

How do I stub the post request inside the fetch_details function to raise the Custom Error?

sparkstar
  • 593
  • 1
  • 7
  • 14

0 Answers0