iOS: Make flutter doctor unhappy if CocoaPods is missing. (#8979)

This commit is contained in:
Jakob Andersen 2017-03-27 12:11:14 +02:00 committed by GitHub
parent d274888be6
commit e93f4a57a1
2 changed files with 31 additions and 0 deletions

View File

@ -181,6 +181,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
if (cocoaPodsInstalledAndMeetsVersionCheck) {
messages.add(new ValidationMessage('CocoaPods version $cocoaPodsVersionText'));
} else {
brewStatus = ValidationType.partial;
if (!hasCocoaPods) {
messages.add(new ValidationMessage.error(
'CocoaPods not installed. To install:\n'

View File

@ -119,6 +119,30 @@ void main() {
expect(result.type, ValidationType.partial);
}, overrides: <Type, Generator>{ Xcode: () => xcode });
testUsingContext('Emits partial status when CocoaPods is not installed', () async {
when(xcode.isInstalled).thenReturn(true);
when(xcode.xcodeVersionText)
.thenReturn('Xcode 8.2.1\nBuild version 8C1002\n');
when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true);
when(xcode.eulaSigned).thenReturn(true);
final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget()
..hasCocoaPods = false;
final ValidationResult result = await workflow.validate();
expect(result.type, ValidationType.partial);
}, overrides: <Type, Generator>{ Xcode: () => xcode });
testUsingContext('Emits partial status when CocoaPods version is too low', () async {
when(xcode.isInstalled).thenReturn(true);
when(xcode.xcodeVersionText)
.thenReturn('Xcode 8.2.1\nBuild version 8C1002\n');
when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true);
when(xcode.eulaSigned).thenReturn(true);
final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget()
..cocoaPodsVersionText = '0.39.0';
final ValidationResult result = await workflow.validate();
expect(result.type, ValidationType.partial);
}, overrides: <Type, Generator>{ Xcode: () => xcode });
testUsingContext('Succeeds when all checks pass', () async {
when(xcode.isInstalled).thenReturn(true);
when(xcode.xcodeVersionText)
@ -165,4 +189,10 @@ class IOSWorkflowTestTarget extends IOSWorkflow {
@override
bool get hasIDeviceInstaller => true;
@override
bool hasCocoaPods = true;
@override
String cocoaPodsVersionText = '1.2.0';
}