Skip to content

Commit

Permalink
Replace custom assertions with bats-assert
Browse files Browse the repository at this point in the history
  • Loading branch information
juanibiapina committed Feb 14, 2016
1 parent 41b55e9 commit 8bb6920
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 81 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "tests/vendor/bats-core"]
path = tests/vendor/bats-core
url = https://github.com/ztombol/bats-core
[submodule "tests/vendor/bats-assert"]
path = tests/vendor/bats-assert
url = https://github.com/ztombol/bats-assert
12 changes: 6 additions & 6 deletions tests/basher-init.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ load test_helper
@test "detects the shell" {
SHELL=/bin/false run basher-init -
assert_success
assert_line 0 'export BASHER_SHELL=bash'
assert_line -n 0 'export BASHER_SHELL=bash'
}

@test "exports BASHER_ROOT" {
BASHER_ROOT=/lol run basher-init - bash
assert_success
assert_line 1 'export BASHER_ROOT=/lol'
assert_line -n 1 'export BASHER_ROOT=/lol'
}

@test "adds cellar/bin to path" {
run basher-init - bash
assert_success
assert_line 2 'export PATH="$BASHER_ROOT/cellar/bin:$PATH"'
assert_line -n 2 'export PATH="$BASHER_ROOT/cellar/bin:$PATH"'
}

@test "setup basher completions if available" {
mkdir -p "$BASHER_ROOT/completions"
touch "$BASHER_ROOT/completions/basher.fakesh"
run basher-init - fakesh
assert_success
assert_line 3 'source "$BASHER_ROOT/completions/basher.fakesh"'
assert_line -n 3 'source "$BASHER_ROOT/completions/basher.fakesh"'
}

@test "does not setup basher completions if not available" {
Expand All @@ -40,11 +40,11 @@ load test_helper
@test "setup package completions (bash)" {
run basher-init - bash
assert_success
assert_line 3 'for f in $(command ls "$BASHER_ROOT/cellar/completions/bash"); do source "$BASHER_ROOT/cellar/completions/bash/$f"; done'
assert_line -n 3 'for f in $(command ls "$BASHER_ROOT/cellar/completions/bash"); do source "$BASHER_ROOT/cellar/completions/bash/$f"; done'
}

@test "setup package completions (zsh)" {
run basher-init - zsh
assert_success
assert_line 3 'fpath=("$BASHER_ROOT/cellar/completions/zsh" $fpath)'
assert_line -n 3 'fpath=("$BASHER_ROOT/cellar/completions/zsh" $fpath)'
}
74 changes: 0 additions & 74 deletions tests/lib/assertions.bash

This file was deleted.

3 changes: 2 additions & 1 deletion tests/test_helper.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load lib/assertions
load vendor/bats-core/load
load vendor/bats-assert/load

export BASHER_TEST_DIR="${BATS_TMPDIR}/basher"
export BASHER_ORIGIN_DIR="${BASHER_TEST_DIR}/origin"
Expand Down
1 change: 1 addition & 0 deletions tests/vendor/bats-assert
Submodule bats-assert added at 55b43c
1 change: 1 addition & 0 deletions tests/vendor/bats-core
Submodule bats-core added at 023b3e

0 comments on commit 8bb6920

Please sign in to comment.