Unverified Commit 12229264 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Show CocoaPods version in hint text (#40117)

parent 3f98fb79
...@@ -167,8 +167,8 @@ class UserMessages { ...@@ -167,8 +167,8 @@ class UserMessages {
'$consequence\n' '$consequence\n'
'To upgrade:\n' 'To upgrade:\n'
'$upgradeInstructions'; '$upgradeInstructions';
String cocoaPodsOutdated(String recVersion, String consequence, String upgradeInstructions) => String cocoaPodsOutdated(String currentVersion, String recVersion, String consequence, String upgradeInstructions) =>
'CocoaPods out of date ($recVersion is recommended).\n' 'CocoaPods $currentVersion out of date ($recVersion is recommended).\n'
'$consequence\n' '$consequence\n'
'To upgrade:\n' 'To upgrade:\n'
'$upgradeInstructions'; '$upgradeInstructions';
......
...@@ -45,8 +45,9 @@ class CocoaPodsValidator extends DoctorValidator { ...@@ -45,8 +45,9 @@ class CocoaPodsValidator extends DoctorValidator {
userMessages.cocoaPodsUnknownVersion(unknownCocoaPodsConsequence, cocoaPodsUpgradeInstructions))); userMessages.cocoaPodsUnknownVersion(unknownCocoaPodsConsequence, cocoaPodsUpgradeInstructions)));
} else { } else {
status = ValidationType.partial; status = ValidationType.partial;
final String currentVersionText = await cocoaPods.cocoaPodsVersionText;
messages.add(ValidationMessage.hint( messages.add(ValidationMessage.hint(
userMessages.cocoaPodsOutdated(cocoaPods.cocoaPodsRecommendedVersion, noCocoaPodsConsequence, cocoaPodsUpgradeInstructions))); userMessages.cocoaPodsOutdated(currentVersionText, cocoaPods.cocoaPodsRecommendedVersion, noCocoaPodsConsequence, cocoaPodsUpgradeInstructions)));
} }
} }
......
...@@ -62,9 +62,20 @@ void main() { ...@@ -62,9 +62,20 @@ void main() {
testUsingContext('Emits partial status when CocoaPods version is too low', () async { testUsingContext('Emits partial status when CocoaPods version is too low', () async {
when(cocoaPods.evaluateCocoaPodsInstallation) when(cocoaPods.evaluateCocoaPodsInstallation)
.thenAnswer((_) async => CocoaPodsStatus.belowRecommendedVersion); .thenAnswer((_) async => CocoaPodsStatus.belowRecommendedVersion);
const String currentVersion = '1.4.0';
when(cocoaPods.cocoaPodsVersionText)
.thenAnswer((_) async => currentVersion);
const String recommendedVersion = '1.8.0';
when(cocoaPods.cocoaPodsRecommendedVersion)
.thenAnswer((_) => recommendedVersion);
const CocoaPodsValidator workflow = CocoaPodsValidator(); const CocoaPodsValidator workflow = CocoaPodsValidator();
final ValidationResult result = await workflow.validate(); final ValidationResult result = await workflow.validate();
expect(result.type, ValidationType.partial); expect(result.type, ValidationType.partial);
expect(result.messages.length, 1);
final ValidationMessage message = result.messages.first;
expect(message.type, ValidationMessageType.hint);
expect(message.message, contains('CocoaPods $currentVersion out of date'));
expect(message.message, contains('($recommendedVersion is recommended)'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
CocoaPods: () => cocoaPods, CocoaPods: () => cocoaPods,
}); });
......
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