From 1480338c5a3da5b6494565ab955ab67a15f19dd3 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 31 Oct 2013 21:52:24 +0100 Subject: app-init: Adding '-s' option to set a configuration option before the resolver is executed and app is installed. The configuration will be available when the app's hooks are executed. o Running the documentation though aspell. --- test/app-init.bats | 42 +++++++++++++++++++++++++++++------------- test/utils.bash | 11 ++++++----- 2 files changed, 35 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/app-init.bats b/test/app-init.bats index 8ffe1b6..2b5d724 100755 --- a/test/app-init.bats +++ b/test/app-init.bats @@ -3,20 +3,22 @@ load utils -#@test "Invalid resolver" { -# app init -d my-app wat; echo_lines -# eq '$status' 1 -# eq '${#lines[*]}' 1 -# eq '${lines[0]}' "No such resolver: wat" -#} +@test "Invalid resolver" { + check_status=no + app init -d my-app wat + eq '$status' 1 + eq '${#lines[*]}' 1 + eq '${lines[0]}' "No such resolver: wat" +} -#@test "Already installed" { -# mkdir -p my-app/.apps -# app init -d my-app maven; echo_lines -# eq '$status' 1 -# eq '${#lines[*]}' 1 -# match '${lines[0]}' "my-app" -#} +@test "Already installed" { + mkdir -p my-app/.app + check_status=no + app init -d my-app maven + eq '$status' 1 + eq '${#lines[*]}' 1 + match '${lines[0]}' "my-app" +} @test "Happy day" { mkzip app-a @@ -74,3 +76,17 @@ load utils match '${lines[0]}' ".*/versions/1.0/root$" eq '${#lines[*]}' 1 } + +@test "app-init: Can pass configuration variables" { + mkzip app-a + app init -d my-app \ + -s "foo.bar=awesome" \ + -s "foo.baz=i love space" \ + -s "foo.wat=2+2=5" file $APPSH_HOME/test/data/app-a.zip + cd my-app + app cat-conf -g foo + match '${lines[0]}' "foo.bar=awesome" + match '${lines[1]}' "foo.baz=i love space" + match '${lines[2]}' "foo.wat=2\+2=5" + eq '${#lines[*]}' 3 +} diff --git a/test/utils.bash b/test/utils.bash index 9979404..930b0f0 100644 --- a/test/utils.bash +++ b/test/utils.bash @@ -39,11 +39,12 @@ echo_lines() { } mkzip() { -( - cd $BATS_TEST_DIRNAME/data/$1 - rm -f ../$1.zip - zip -qr ../$1.zip * -) + local name=$1; shift + pushd . + cd $BATS_TEST_DIRNAME/data/$name + rm -f ../$name.zip + zip -qr ../$name.zip * + popd } install_artifact() { -- cgit v1.2.3