forked from postmodern/chruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchruby_test.sh
More file actions
executable file
·71 lines (51 loc) · 1.21 KB
/
chruby_test.sh
File metadata and controls
executable file
·71 lines (51 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
. ./test/helper.sh
function setUp()
{
original_rubies=(${RUBIES[@]})
}
function tearDown()
{
chruby_reset
RUBIES=(${original_rubies[@]})
}
function test_chruby_default_RUBIES()
{
assertEquals "did not correctly populate RUBIES" \
"$test_ruby_root" \
"${RUBIES[*]}"
}
function test_chruby_2_0()
{
chruby "2.0" >/dev/null
assertEquals "did not match 2.0" "$test_ruby_root" "$RUBY_ROOT"
}
function test_chruby_multiple_matches()
{
RUBIES=(/path/to/ruby-2.0.0 "$test_ruby_root")
chruby "2.0" >/dev/null
assertEquals "did not use the last match" "$test_ruby_root" "$RUBY_ROOT"
}
function test_chruby_exact_match_first()
{
RUBIES=("$test_ruby_root" "$test_ruby_root-rc1")
chruby "${test_ruby_root##*/}"
assertEquals "did not use the exact match" "$test_ruby_root" "$RUBY_ROOT"
}
function test_chruby_system()
{
chruby "$test_ruby_version" >/dev/null
chruby system
assertNull "did not reset the Ruby" "$RUBY_ROOT"
}
function test_chruby_unknown()
{
chruby "does_not_exist" 2>/dev/null
assertEquals "did not return 1" 1 $?
}
function test_chruby_invalid_ruby()
{
RUBIES=(/does/not/exist/jruby)
chruby "jruby" 2>/dev/null
assertEquals "did not return 1" 1 $?
}
SHUNIT_PARENT=$0 . $SHUNIT2