asdf/test/utils.bats

48 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bats
2016-06-28 20:56:33 -07:00
load test_helpers
setup() {
2016-06-28 20:56:33 -07:00
setup_asdf_dir
2016-07-23 17:03:43 -07:00
install_dummy_plugin
install_dummy_version "0.1.0"
install_dummy_version "0.2.0"
PROJECT_DIR=$BASE_DIR/project
mkdir -p $PROJECT_DIR
}
teardown() {
2016-06-28 20:56:33 -07:00
clean_asdf_dir
}
@test "check_if_version_exists should exit with 1 if plugin does not exist" {
2016-07-23 17:03:43 -07:00
run check_if_version_exists "inexistent" "1.0.0"
[ "$status" -eq 1 ]
2016-07-23 17:03:43 -07:00
[ "$output" = "version 1.0.0 is not installed for inexistent" ]
}
@test "check_if_version_exists should exit with 1 if version does not exist" {
2016-07-23 17:03:43 -07:00
run check_if_version_exists "dummy" "1.0.0"
[ "$status" -eq 1 ]
2016-07-23 17:03:43 -07:00
[ "$output" = "version 1.0.0 is not installed for dummy" ]
}
@test "check_if_version_exists should be noop if version exists" {
2016-07-23 17:03:43 -07:00
run check_if_version_exists "dummy" "0.1.0"
[ "$status" -eq 0 ]
[ "$output" = "" ]
}
@test "check_if_plugin_exists should exit with 1 when plugin is empty string" {
run check_if_plugin_exists
[ "$status" -eq 1 ]
[ "$output" = "No such plugin" ]
}
@test "check_if_plugin_exists should be noop if plugin exists" {
2016-07-23 17:03:43 -07:00
run check_if_plugin_exists "dummy"
[ "$status" -eq 0 ]
[ "$output" = "" ]
}