has/.hastest.bats

23 lines
475 B
Plaintext
Raw Normal View History

2017-08-28 18:07:44 +02:00
#!/usr/bin/env bats
@test "works with single command check" {
run bash has git
2017-08-28 18:07:44 +02:00
[ "$status" -eq 0 ]
[[ $output == *"✔ git"* ]]
2017-08-28 18:07:44 +02:00
}
@test "safely tells about tools not configured" {
run bash has something-missing
2017-08-28 18:07:44 +02:00
[ "$status" -eq 1 ]
[[ $output == *"✘ something-missing not understood"* ]]
2017-08-28 18:07:44 +02:00
}
@test "env var lets override safety check" {
HAS_ALLOW_UNSAFE=y run bash has something-missing
2017-08-28 18:07:44 +02:00
[ "$status" -eq 1 ]
[[ $output == *"✘ something-missing"* ]]
2017-08-28 18:07:44 +02:00
}