我想寫一個rspec spec來測試我的邏輯能夠處理具有狀態碼401的特定Net :: HTTPResponse。 m使用HTTParty,.get將返回一個HTTPartyResponse,我將通過httparty_repsonse_object.response檢索Net :: HTTPResponse。Stub一個HTTP請求返回一個HTTP :: HTTPResponse與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)