Tôi đang cố gắng viết thông số rspec để kiểm tra xem logic của tôi có thể xử lý một Net :: HTTPResponse cụ thể có mã trạng thái 401. Như tôi ' m bằng cách sử dụng HTTParty, .get sẽ trả lại cho tôi một HTTPartyResponse và tôi sẽ truy xuất Net :: HTTPResponse với httparty_repsonse_object.response.Gửi yêu cầu http trả lại HTTPartyResponse bằng Net :: HTTPResponse
net_response_object = Net::HTTPResponse.new(1.1, 401, 'Forbidden')
#not sure what to do here? write a test double to return a net_response_object?
stub_request(:any, /hello.com/).to_return(a_http_party_response_object)