export PATH="$BATS_TEST_DIRNAME/stub:$PATH"

stub() {
  if [ ! -d $BATS_TEST_DIRNAME/stub ]; then
    mkdir $BATS_TEST_DIRNAME/stub
  fi
  touch $BATS_TEST_DIRNAME/stub/$1
  [ -z "$3" ] && local rc=0 || local rc="$3"
  echo "echo $2; exit $rc" > $BATS_TEST_DIRNAME/stub/$1
  chmod +x $BATS_TEST_DIRNAME/stub/$1
}

rm_stubs() {
  /usr/bin/rm -rf $BATS_TEST_DIRNAME/stub
}

export PATH="$BATS_TEST_DIRNAME/stub:$PATH"

stub() {
  if [ ! -d $BATS_TEST_DIRNAME/stub ]; then
    mkdir $BATS_TEST_DIRNAME/stub
  fi
  touch $BATS_TEST_DIRNAME/stub/$1
  [ -z "$3" ] && local rc=0 || local rc="$3"
  echo "echo $2; exit $rc" > $BATS_TEST_DIRNAME/stub/$1
  chmod +x $BATS_TEST_DIRNAME/stub/$1
}

rm_stubs() {
  /bin/rm -rf $BATS_TEST_DIRNAME/stub
}

Change rm command path to /bin
Change rm command path to /bin
