Stubbing and Setting Expectations on HTTP Requests Is Now Easy With WebMock

WebMock.allow_net_connect!

response = {

    "data": {

        "date": "2019-10-01",

        "total_cvs": 86,

        "total_auto_approved": 50,

        "total_auto_rejected": 4,

        "total_manual_reviewed": 26,

        "total_pending": 6,

        "avg_time_manual_reviewed": 104,

        "avg_time_total_reviewed": 31,

        "total_cvs_reviewed_by_admin": {

            "anhnguyen@itviec.com": 3,

            "binh@itviec.com": 3,

            "career@hoozing.com": 1,

            "career@nashtechglobal.com": 2,

            "chile@itviec.com": 1,

            "dan@itviec.com": 1,

            "duchien@itviec.com": 1,

            "dung@itviec.com": 6

        }

    }

}

stub_request(:any, /api\/v2\/pending_duration_reports/).to_return(status: 200, body: response.to_json)