If I remove a cell from the identifier in the storyboard, as in the unit testing method, can I call cellForRowAtIndexPath and not have cell nil?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { MyCustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCustomCell]; cell.guestNameText.text = self.details.guestName; return cell; }
Doesnβt work, put a breakpoint above, after calling dequeReusableCell, and the cell is zero:
ETA: UPDATED WORK CODE FOR TEST TEST:
- (void)setUp { [super setUp]; _detailVC_SUT = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:kDetailsVC]; _myService = [OCMockObject niceMockForClass:[MyService class]]; _detailVC_SUT.service = _myService; } - (void)test_queryForDetailsSucceeded_should_set_cell_text_fields { [_detailVC_SUT view];
source share