2016-04-24 08:11:33 -07:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
2016-06-28 20:56:33 -07:00
|
|
|
load test_helpers
|
2016-04-24 08:11:33 -07:00
|
|
|
|
|
|
|
setup() {
|
2016-06-28 20:56:33 -07:00
|
|
|
setup_asdf_dir
|
2016-04-24 08:11:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
teardown() {
|
2016-06-28 20:56:33 -07:00
|
|
|
clean_asdf_dir
|
2016-04-24 08:11:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "check_if_version_exists should exit with 1 if plugin does not exist" {
|
|
|
|
mkdir -p $ASDF_DIR/installs
|
|
|
|
run check_if_version_exists "foo" "1.0.0"
|
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
[ "$output" = "version 1.0.0 is not installed for foo" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "check_if_version_exists should exit with 1 if version does not exist" {
|
|
|
|
mkdir -p $ASDF_DIR/installs/foo
|
|
|
|
run check_if_version_exists "foo" "1.0.0"
|
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
[ "$output" = "version 1.0.0 is not installed for foo" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "check_if_version_exists should be noop if version exists" {
|
|
|
|
mkdir -p $ASDF_DIR/installs/foo/1.0.0
|
|
|
|
run check_if_version_exists "foo" "1.0.0"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$output" = "" ]
|
|
|
|
}
|