Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My first recommendation is that you should not test your libraries. From what I read in your example, you are basically checking that <code>AFHTTPRequestOperation</code> is working as documented, but that’s not your responsability to test. You should test that you invoke AFNetworking correctly, and that given an <code>responseObject</code> or an error, your code behaves as you expect. </p> <p>Anyway, about what you are seeing, you have two “shoulds” in the same line: <code>shouldEventually</code> and <code>shouldBeNil</code>; they use to have <code>beNil</code> matcher, which is unavailable in 2.1, and I think they are bringing back. You can find the discussion in <a href="https://github.com/allending/Kiwi/issues/293" rel="nofollow">https://github.com/allending/Kiwi/issues/293</a></p> <p>Maybe you can try the following to make sure that the failure branch is not taken:</p> <pre><code>[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { testResponseObject = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { // This will fail if we ever reach this branch [error shouldBeNil]; }]; [apiClient enqueueHTTPRequestOperation:operation]; [[expectFutureValue(testResponseObject) shouldEventuallyBeforeTimingOutAfter(100)] equal:@"Expected Content"]; </code></pre> <p>The <code>shouldEventuallyBeforeTimingOutAfter</code> will keep the test case “alive” waiting to check the response, but if you ever go through the failure branch, the other expectation will fail (and also the one in response will fail after 100 seconds). Hope it helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload