Commit e93f4a57 authored by Jakob Andersen's avatar Jakob Andersen Committed by GitHub

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

parent d274888b
...@@ -181,6 +181,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { ...@@ -181,6 +181,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
if (cocoaPodsInstalledAndMeetsVersionCheck) { if (cocoaPodsInstalledAndMeetsVersionCheck) {
messages.add(new ValidationMessage('CocoaPods version $cocoaPodsVersionText')); messages.add(new ValidationMessage('CocoaPods version $cocoaPodsVersionText'));
} else { } else {
brewStatus = ValidationType.partial;
if (!hasCocoaPods) { if (!hasCocoaPods) {
messages.add(new ValidationMessage.error( messages.add(new ValidationMessage.error(
'CocoaPods not installed. To install:\n' 'CocoaPods not installed. To install:\n'
......
...@@ -119,6 +119,30 @@ void main() { ...@@ -119,6 +119,30 @@ void main() {
expect(result.type, ValidationType.partial); expect(result.type, ValidationType.partial);
}, overrides: <Type, Generator>{ Xcode: () => xcode }); }, 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 { testUsingContext('Succeeds when all checks pass', () async {
when(xcode.isInstalled).thenReturn(true); when(xcode.isInstalled).thenReturn(true);
when(xcode.xcodeVersionText) when(xcode.xcodeVersionText)
...@@ -165,4 +189,10 @@ class IOSWorkflowTestTarget extends IOSWorkflow { ...@@ -165,4 +189,10 @@ class IOSWorkflowTestTarget extends IOSWorkflow {
@override @override
bool get hasIDeviceInstaller => true; bool get hasIDeviceInstaller => true;
@override
bool hasCocoaPods = true;
@override
String cocoaPodsVersionText = '1.2.0';
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment