Skip to content

Commit 0016959

Browse files
authored
Fix tests (postmodern#435)
* Fix old Makefile references to test/opt/rubies * Fail early if missing the ruby to test * The expected PATH needs to be captured after chruby_reset * Do not update all Homebrew packages just to install shunit2
1 parent 395457b commit 0016959

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ addons:
1717
- zsh
1818

1919
install:
20-
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install shunit2 bash; fi
20+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install shunit2 bash; fi
2121

2222
before_script:
2323
- sudo rm -rf $HOME/.rvm $HOME/.rvmrc

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ verify: $(PKG) $(SIG)
3838
gpg --verify $(SIG) $(PKG)
3939

4040
clean:
41-
rm -rf test/opt/rubies
41+
rm -rf test/fixtures/opt/rubies
4242
rm -f $(PKG) $(SIG)
4343

4444
check:
4545
shellcheck share/$(NAME)/*.sh
4646

47-
test/opt/rubies:
47+
test/fixtures/opt/rubies:
4848
./test/setup
4949

50-
test: test/opt/rubies
50+
test: test/fixtures/opt/rubies
5151
SHELL=`command -v bash` ./test/runner
5252
SHELL=`command -v zsh` ./test/runner
5353

test/helper.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@ test_ruby_version_x_y="${test_ruby_version%.*}"
1313
test_ruby_api="${TEST_RUBY_API:-${test_ruby_version%.*}.0}"
1414
test_ruby_root="$PWD/test/fixtures/opt/rubies/$test_ruby_engine-$test_ruby_version"
1515

16-
test_path="$PATH"
16+
if [[ "$(basename "$0")" != "setup" && ! -d "$test_ruby_root" ]]; then
17+
echo "$test_ruby_root needs to exist, use test/setup or build a Ruby there"
18+
exit 2
19+
fi
20+
1721
test_gem_home="$HOME/.gem/$test_ruby_engine/$test_ruby_version"
1822
test_gem_root="$test_ruby_root/lib/ruby/gems/$test_ruby_api"
1923

2024
. ./share/chruby/chruby.sh
2125
chruby_reset
2226

27+
# Capture the PATH after chruby_reset
28+
test_path="$PATH"
29+
2330
setUp() { return; }
2431
tearDown() { return; }
2532
oneTimeTearDown() { return; }

0 commit comments

Comments
 (0)