File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1818
1919init || exit $?
2020
21+ if [[ ! -w " $install_dir " ]]; then
22+ fail " Installation directory is not writable by the user: $install_dir "
23+ fi
24+
2125if [[ $no_reinstall -eq 1 ]] && [[ -x " $install_dir /bin/ruby" ]]; then
2226 log " Ruby is already installed into $install_dir "
2327 exit
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ . ./test/helper.sh
4+
5+ test_install_dir=" $test_fixtures_dir /no_permission_warn_test"
6+
7+ function setUp()
8+ {
9+ mkdir -p " $test_install_dir "
10+ chmod -w " $test_install_dir "
11+ }
12+
13+ function test_no_install_when_write_permissions_lacking()
14+ {
15+ local output
16+ local status
17+
18+ output=" $( ruby-install --install-dir " $test_install_dir " ruby 2>&1 ) " || status=$?
19+
20+ assertEquals " did not return 0" 255 $status
21+ assertTrue " did not print a message to STDOUT" \
22+ ' [[ "$output" == *"Installation directory is not writable by the user: ${install_dir}"* ]]'
23+ }
24+
25+ function tearDown()
26+ {
27+ rm -rf " $test_install_dir "
28+ }
29+
30+ SHUNIT_PARENT=$0 . $SHUNIT2
You can’t perform that action at this time.
0 commit comments