Next, we create a mock connection, just like last time, except now we tell it to also expect a call to
In addition to calling
start, we’re also going to manually invoke the
connection:didReceiveResponse:. This means we’ll need a response to pass in as the second parameter. That’s where the
mockResponseobject comes in. We’ll create a mock
NSHTTPURLResponsethat returns 404 when ask for its status code. This is how we will simulate the connection failure.