title: iOS unit test: test that an KVO observer is called
body: <p>I've got a KVO scenario test like this:</p>
  
  <pre><code>- (void)testObserverCalled
  {
      __block BOOL executed = NO;
      [[RACObserve(model, dateText) skip:1] subscribeNext:^(id x) {
          executed = YES;
      }];
      [model setDate:[NSDate date]];
      XCTAssertTrue(executed);
  }
  </code></pre>
  
  <p>Currently I use a executed BOOL value to test if the observer block is called, is there any better way like an assert that must be called before test function end?</p>
  
  <p>like this:</p>
  
  <pre><code>XCAssertCalledBeforeFunctionReturn()
  </code></pre>
  
  <p>So that I can change my code to:</p>
  
  <pre><code>- (void)testObserverCalled
  {
      [[RACObserve(model, dateText) skip:1] subscribeNext:^(id x) {
          XCAssertCalledBeforeFunctionReturn()
      }];
      [model setDate:[NSDate date]];
  }
  </code></pre>