Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rbenv version- test coverage for preferring local over global version file #1456

Merged
merged 1 commit into from
Oct 17, 2022

Conversation

richiethomas
Copy link
Contributor

While reading the version.bats file, I noticed that we have the following two specs:

@test "set by local file" {
  create_version "1.9.3"
  cat > ".ruby-version" <<<"1.9.3"
  run rbenv-version
  assert_success "1.9.3 (set by ${PWD}/.ruby-version)"
}

@test "set by global file" {
  create_version "1.9.3"
  cat > "${RBENV_ROOT}/version" <<<"1.9.3"
  run rbenv-version
  assert_success "1.9.3 (set by ${RBENV_ROOT}/version)"
}

These tests ensure that RBENV is able to either a) pull the version from the local .ruby-version file, or b) pull it from the global "${RBENV_ROOT}/version" file. However I notice that there's no test to assert which should be favored over the other, if both exist. In the spirit of "tests as executable documentation", this seems like a useful addition.

This PR adds that additional test.

Copy link
Member

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nice. Thank you!

@mislav mislav merged commit 52acbdf into rbenv:master Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants