Skip to content

Commit

Permalink
Speed up test execution by skipping brew in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Scott committed May 30, 2015
1 parent f67152c commit 4ca81c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
6 changes: 5 additions & 1 deletion bin/homer-init
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# Override $HOMER_HOME with the first argument to homer init if given.
if [ ! -z "$2" ]; then
HOMER_HOME=$2
else
HOMER_HOME=$HOME
fi

source "$HOMER_PATH/share/homer/cli.zsh"
Expand Down Expand Up @@ -34,4 +36,6 @@ else
fi

# Update Homebrew packages
homer_brew
if [[ -z "${SKIP_BREW+x}" ]]; then
homer_brew
fi
17 changes: 6 additions & 11 deletions test/homer-init-test.bats
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
#!/usr/bin/env bats

setup() {
mkdir $PWD/tmp
}

teardown() {
rm -rf $PWD/tmp
export SKIP_BREW='true'
}

@test "initialize a git repo in the home dir" {
export HOME="$PWD/tmp"
./bin/homer init
./bin/homer init $BATS_TMPDIR/home
}

@test "print an error and exit if git repo already exists" {
export HOME=$PWD/tmp
mkdir -p $PWD/tmp/.git/
touch $PWD/tmp/.git/ORIG_HEAD
./bin/homer init
mkdir -p $BATS_TMPDIR/home/.git
touch $BATS_TMPDIR/home/.git/ORIG_HEAD

./bin/homer init $BATS_TMPDIR/home
}

0 comments on commit 4ca81c8

Please sign in to comment.