From d3f5a70172a589ed454de7018870eeff3cc7a242 Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Mon, 5 Feb 2018 13:16:18 -0800 Subject: [PATCH] add git-open.bats for general tests. For blaming: https://github.com/paulirish/git-open/blame/7449bfa7e100eb3bdd80058f3e99cfefb255e4f1/test/git-open.bats --- test/git-open.bats | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 test/git-open.bats diff --git a/test/git-open.bats b/test/git-open.bats new file mode 100755 index 0000000..267505b --- /dev/null +++ b/test/git-open.bats @@ -0,0 +1,42 @@ +#!/usr/bin/env bats + +load "test_helper/index" + +## +## Test environment +## +@test "test environment" { + assert_equal "$BROWSER" "echo" + cd .. + assert [ -e "$foldername" ] + assert [ -e "$foldername/.git" ] +} + +## +## Help +## + +@test "help text" { + run ../git-open -h + assert_output --partial "usage: git open" +} + +@test "invalid option" { + run ../git-open --invalid-option + assert_output --partial "error: unknown option \`invalid-option'" + assert_output --partial "usage: git open" +} + +## +## url handling +## + +@test "url: insteadOf handling" { + git config --global url.http://example.com/.insteadOf ex: + git remote set-url origin ex:example.git + git checkout -B master + run ../git-open + assert_output "http://example.com/example" +} + +