-
Notifications
You must be signed in to change notification settings - Fork 0
XCTestCase delegate
This protocol describe interface, which can be used by subclasses of YHVTestCase to dynamically adjust configuration used by VCR and cassette.
Implement this method inside of class with tests to tell whether VCR should be used or not.
- (BOOL)shouldSetupVCR {
// Use VCR only in case if test case method contain 'Stubbed' in it's name.
return [self.name rangeOfString:@"Stubbed"].location != NSNotFound;
}Whether VCR should be used for particular test case or not.
This callback used by YHVTestCase right before configuration object will be passed to VCR with +setupWithConfiguration:. This is last chance to modify configuration before VCR configuration for test case will be completed.
- (void)updateVCRConfigurationFromDefaultConfiguration:(YHVConfiguration *)configuration {
/**
* Record any requests from test case which contain 'OutdatedStub' in it's
* name (something changed and stubbed data should be reloaded).
*/
if ([self.name rangeOfString:@"OutdatedStub"].location != NSNotFound) {
configuration.recordMode = YHVRecordAll;
}
}| Name | Type | Description |
|---|---|---|
configuration |
YHVConfiguration |
Reference on configuration instance which will be sent to VCR for setup completion. |
This callback used by YHVTestCase right before configuration object will be passed to VCR with +insertCassetteWithConfiguration:. This is last chance to modify cassette configuration before VCR configuration for test case will be completed.
- (void)updateVCRConfigurationFromDefaultConfiguration:(YHVConfiguration *)configuration {
/**
* Change responses playback flow from chronological to momentary - in this
* mode when requested, stubbed data will be returned till data task will
* report completion.
*/
if ([self.name rangeOfString:@"Momentary"].location != NSNotFound) {
configuration.playbackMode = YHVMomentaryPlayback;
}
}| Name | Type | Description |
|---|---|---|
configuration |
YHVConfiguration |
Reference on configuration instance which will be sent to during cassette insertion. |