From e97ca5f72cb7a0c0f55c2b6fa3f48d13d1425527 Mon Sep 17 00:00:00 2001 From: Marco Vermeulen Date: Wed, 21 Dec 2016 09:05:29 +0000 Subject: [PATCH] Refine cuke of sdkman_auto_answer configuration on installation. --- src/main/bash/sdkman-install.sh | 2 +- src/test/cucumber/install_candidate.feature | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/bash/sdkman-install.sh b/src/main/bash/sdkman-install.sh index 3f384841..8da28bb4 100644 --- a/src/main/bash/sdkman-install.sh +++ b/src/main/bash/sdkman-install.sh @@ -36,7 +36,7 @@ function __sdk_install { __sdkman_determine_current_version "$candidate" __sdkman_install_candidate_version "$candidate" "$VERSION" || return 1 - if [[ "$sdkman_auto_answer" != 'true' && "$auto_answer_outdated" != 'true' && -n "$CURRENT"]]; then + if [[ "$sdkman_auto_answer" != 'true' && "$auto_answer_outdated" != 'true' && -n "$CURRENT" ]]; then echo -n "Do you want ${candidate} ${VERSION} to be set as default? (Y/n): " read USE fi diff --git a/src/test/cucumber/install_candidate.feature b/src/test/cucumber/install_candidate.feature index e7164517..cb05f41f 100644 --- a/src/test/cucumber/install_candidate.feature +++ b/src/test/cucumber/install_candidate.feature @@ -4,7 +4,7 @@ Feature: Install Candidate Given the internet is reachable And an initialised environment - Scenario: Install a default Candidate + Scenario: Install a default Candidate and set to default Given the system is bootstrapped And the candidate "grails" version "2.1.0" is a valid candidate version And the default "grails" version is "2.1.0" @@ -13,7 +13,7 @@ Feature: Install Candidate And I do not see "Do you want grails 2.1.0 to be set as default? (Y/n)" And the candidate "grails" version "2.1.0" is installed - Scenario: Install a specific Candidate + Scenario: Install a specific Candidate and set to default Given the system is bootstrapped And the candidate "grails" version "1.3.9" is available for download When I enter "sdk install grails 1.3.9" @@ -34,7 +34,7 @@ Feature: Install Candidate When I enter "sdk install grails 1.3.9" Then I see "Stop! grails 1.3.9 is already installed." - Scenario: Install a candidate and select to use it automatically + Scenario: Install a candidate and auto-answer to make it default Given the system is bootstrapped And the candidate "grails" version "2.1.0" is available for download And I have configured "sdkman_auto_answer" to "true" @@ -42,11 +42,22 @@ Feature: Install Candidate Then the candidate "grails" version "2.1.0" is installed And I do not see "Do you want grails 2.1.0 to be set as default?" And I see "Done installing!" - And I do not see "Do you want grails 2.1.0 to be set as default? (Y/n)" And I see "Setting grails 2.1.0 as default." And the candidate "grails" version "2.1.0" should be the default - Scenario: Install a candidate and do not select to use it + Scenario: Install a candidate and choose to make it default + Given the candidate "grails" version "1.3.9" is already installed and default + And the system is bootstrapped + And the candidate "grails" version "2.1.0" is available for download + When I enter "sdk install grails 2.1.0" and answer "Y" + Then the candidate "grails" version "2.1.0" is installed + And I see "Done installing!" + And I see "Do you want grails 2.1.0 to be set as default? (Y/n)" + And I see "Setting grails 2.1.0 as default." + And the candidate "grails" version "2.1.0" should be the default + And the candidate "grails" version "1.3.9" should not be the default + + Scenario: Install a candidate and choose not to make it default Given the candidate "grails" version "1.3.9" is already installed and default And the system is bootstrapped And the candidate "grails" version "2.1.0" is available for download