Skip to content

Commit

Permalink
Setup bats to use a locally compiled version of .ahoy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Carey committed Nov 21, 2016
1 parent 0479480 commit fdc5774
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ commands:
usage: Build ahoy using go install.
bats:
usage: "Run the bats bash testing command."
cmd: bats tests
cmd: |
ahoy build
bats tests
test:
usage: Run automated tests
cmd: |
Expand Down
7 changes: 4 additions & 3 deletions tests/flags.bats
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env bats

@test "get the version of ahoy with --version" {
result="$(ahoy -f testdata/simple.ahoy.yml --version)"
[ "$result" == "master" ]
run ./ahoy -f testdata/simple.ahoy.yml --version
[ $status -eq 0 ]
[ "$result" == "2.0.0-alpha-23-g0479480" ]
}

@test "get help instead of running a command with --help" {
result="$(ahoy -f testdata/simple.ahoy.yml --help echo something)"
result="$(./ahoy -f testdata/simple.ahoy.yml --help echo something)"
[ "$result" != "something" ]
}
2 changes: 1 addition & 1 deletion tests/no-ahoy-file.bats
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ teardown() {
}

@test "run ahoy init without a .ahoy.yml file" {
result="$(ahoy init)"
result="$(./ahoy init)"
[ "$result" -eq 4 ]
}
9 changes: 8 additions & 1 deletion tests/simple.bats
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/usr/bin/env bats

@test "display help text when no arguments are passed." {
run ./ahoy -f testdata/simple.ahoy.yml
# Should throw an error.
[ "${#lines[@]}" -gt 14 ]
[ $status -eq 1 ]
}

@test "run a simple ahoy command: echo" {
result="$(ahoy -f testdata/simple.ahoy.yml echo something)"
result="$(./ahoy -f testdata/simple.ahoy.yml echo something)"
[ "$result" == "something" ]
}
11 changes: 0 additions & 11 deletions tests/test.bats

This file was deleted.

0 comments on commit fdc5774

Please sign in to comment.