domains plugin unit tests and fix for errant substring match

This commit is contained in:
Michael Hobbs committed 2014-12-21 14:51:42 -08:00
1 parent d1e94f6c91
commit 283432f214
2 files changed
+67

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bats
load test_helper
setup() {
deploy_app
}
teardown() {
destroy_app
}
@test "domains" {
run bash -c "dokku domains $TEST_APP | grep ${TEST_APP}.dokku.me"
echo "output: "$output
echo "status: "$status
assert_output "${TEST_APP}.dokku.me"
}
@test "domains:add" {
run dokku domains:add $TEST_APP www.test.app.dokku.me
echo "output: "$output
echo "status: "$status
assert_success
run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
assert_success
}
@test "domains:remove" {
run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
assert_success
run dokku domains:remove $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
refute_line "test.app.dokku.me"
}
@test "domains:clear" {
run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
assert_success
run dokku domains:clear $TEST_APP
echo "output: "$output
echo "status: "$status
assert_success
}
+16
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# constants # constants
TEST_APP=my-cool-guy-test-app TEST_APP=my-cool-guy-test-app
@@ -85,3 +86,18 @@ create_app() {
destroy_app() { destroy_app() {
echo $TEST_APP | dokku apps:destroy $TEST_APP echo $TEST_APP | dokku apps:destroy $TEST_APP
} }
deploy_app() {
TMP=$(mktemp -d -t "$TARGET.XXXXX")
rmdir $TMP && cp -r ./tests/apps/config $TMP
cd $TMP
git init
git config user.email "robot@example.com"
git config user.name "Test Robot"
git remote add target dokku@dokku.me:$TEST_APP
[[ -f gitignore ]] && mv gitignore .gitignore
git add .
git commit -m 'initial commit'
git push target master || destroy_app
}