Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c070e63

Browse files
committed
Added the first shunit2 unit-test.
1 parent e310dd5 commit c070e63

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

test/chruby_reset_test.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
. test/helper.sh
4+
5+
function before_chruby_reset()
6+
{
7+
export RUBY_VERSION="1.9.3"
8+
export RUBY_PATCHLEVEL="194"
9+
export RUBY_ENGINE="ruby"
10+
export RUBY="/usr/local/$RUBY_ENGINE-$RUBY_VERSION-p$RUBY_PATCHLEVEL"
11+
export GEM_ROOT="$RUBY/lib/ruby/gems/1.9.1/bin"
12+
export GEM_HOME="$HOME/.gem/$RUBY_ENGINE/$RUBY_VERSION"
13+
14+
export PATH="$GEM_HOME/bin:$GEM_ROOT/bin:$RUBY/bin:$ORIGINAL_PATH"
15+
}
16+
17+
test_chruby_reset()
18+
{
19+
before_chruby_reset
20+
21+
chruby_reset
22+
23+
assertNull "RUBY was not unset", $RUBY
24+
assertNull "RUBY_ENGINE was not unset", $RUBY_ENGINE
25+
assertNull "RUBY_VERSION was not unset", $RUBY_VERSION
26+
assertNull "RUBYOPT was not unset", $RUBYOPT
27+
assertNull "GEM_HOME was not unset", $GEM_HOME
28+
assertNull "GEM_PATH was not unset", $GEM_PATH
29+
}

test/helper.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
source ./etc/profile.d/chruby.sh
4+
RUBIES=(/usr/local/ruby-1.9.3-p194)
5+
6+
chruby_reset
7+
ORIGINAL_PATH=$PATH

0 commit comments

Comments
 (0)