create local .ruby-version file in test dir

This new test was creating an (intentionally invalid) .ruby-version file
in current working directory; typically the rbenv project dir.
Immediately after test runs, I had a leftover .ruby-version file.

The version-file tests create and cd into the RBENV_TEST_DIR as part of
setup(). I'm using the same directory for this test fix, but am only
using it for this particular test. None of the other exec tests seem to
need to be in a temp test dir, so no use putting it in setup().
This commit is contained in:
Jason Karns 2015-11-20 09:51:21 -05:00
parent 63671a1479
commit a3ff3adc39

View file

@ -21,6 +21,8 @@ create_executable() {
} }
@test "fails with invalid version set from file" { @test "fails with invalid version set from file" {
mkdir -p "$RBENV_TEST_DIR"
cd "$RBENV_TEST_DIR"
echo 1.9 > .ruby-version echo 1.9 > .ruby-version
run rbenv-exec rspec run rbenv-exec rspec
assert_failure "rbenv: version \`1.9' is not installed (set by $PWD/.ruby-version)" assert_failure "rbenv: version \`1.9' is not installed (set by $PWD/.ruby-version)"