Remove suite-wide setup

Bats doesn't support both suite-wide setup (in helper) *and* file-wide
setup. Which means the existance of any file-level setup() function
overwrites any setup() function from test_helper. This can be confusing,
and (IMO) easier to simply avoid the overwriting and remove any
_implied_ suite-wide setup function from test_helper.

This turns out to not be so bad for the recently added setup function,
because the only test files that actually need aria2c removed from PATH
are those that actually invoke curl. These can be found because they are
the only test files that stub curl; half of which already had
file-specific setup() functions. So the only ones which need a
file-local setup() function added were: checksum.bats and mirror.bats

Along these lines, rbenv.bats and hooks.bats were removing aria2c from
PATH but don't actually need to. (curl isn't stubbed in these tests so
the existance of aria2c wouldn't affect the tests)

Lastly, fixed a tab/spaces whitespace mixup that was introduced by:
750c086d11
This commit is contained in:
Jason Karns 2016-08-13 15:18:00 -04:00
parent f666e71656
commit 21494ba359
6 changed files with 10 additions and 8 deletions

View file

@ -1222,9 +1222,9 @@ if [ -z "$MAKE" ]; then
export MAKE="gmake"
else
if [ "$(uname -r | sed 's/[^[:digit:]].*//')" -lt 10 ]; then
export MAKE="gmake"
export MAKE="gmake"
else
export MAKE="make"
export MAKE="make"
fi
fi
else

View file

@ -5,6 +5,10 @@ export RUBY_BUILD_SKIP_MIRROR=1
export RUBY_BUILD_CACHE_PATH=
export RUBY_BUILD_CURL_OPTS=
setup() {
ensure_not_found_in_path aria2c
}
@test "package URL without checksum" {
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"

View file

@ -3,7 +3,6 @@
load test_helper
setup() {
ensure_not_found_in_path aria2c
export RBENV_ROOT="${TMP}/rbenv"
export HOOK_PATH="${TMP}/i has hooks"
mkdir -p "$HOOK_PATH"

View file

@ -6,6 +6,10 @@ export RUBY_BUILD_CACHE_PATH=
export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
export RUBY_BUILD_CURL_OPTS=
setup() {
ensure_not_found_in_path aria2c
}
@test "package URL without checksum bypasses mirror" {
stub shasum true

View file

@ -4,7 +4,6 @@ load test_helper
export RBENV_ROOT="${TMP}/rbenv"
setup() {
ensure_not_found_in_path aria2c
stub rbenv-hooks 'install : true'
stub rbenv-rehash 'true'
}

View file

@ -38,10 +38,6 @@ ensure_not_found_in_path() {
done
}
setup() {
ensure_not_found_in_path aria2c
}
teardown() {
rm -fr "${TMP:?}"/*
}