aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-10-31 21:52:24 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-11-01 19:58:08 +0100
commit1480338c5a3da5b6494565ab955ab67a15f19dd3 (patch)
treedf68073fad776481251093fd60a901fa7c905bec /test
parent40eaf2303f013321b923c5bb616f0579a01a9884 (diff)
downloadapp.sh-1480338c5a3da5b6494565ab955ab67a15f19dd3.tar.gz
app.sh-1480338c5a3da5b6494565ab955ab67a15f19dd3.tar.bz2
app.sh-1480338c5a3da5b6494565ab955ab67a15f19dd3.tar.xz
app.sh-1480338c5a3da5b6494565ab955ab67a15f19dd3.zip
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.
Diffstat (limited to 'test')
-rwxr-xr-xtest/app-init.bats42
-rw-r--r--test/utils.bash11
2 files changed, 35 insertions, 18 deletions
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() {