| 1 | + | #!/usr/bin/env bats |
| 2 | + | |
| 3 | + | load "test_helper/index" |
| 4 | + | |
| 5 | + | ## |
| 6 | + | ## Test environment |
| 7 | + | ## |
| 8 | + | @test "test environment" { |
| 9 | + | assert_equal "$BROWSER" "echo" |
| 10 | + | cd .. |
| 11 | + | assert [ -e "$foldername" ] |
| 12 | + | assert [ -e "$foldername/.git" ] |
| 13 | + | } |
| 14 | + | |
| 15 | + | ## |
| 16 | + | ## Help |
| 17 | + | ## |
| 18 | + | |
| 19 | + | @test "help text" { |
| 20 | + | run ../git-open -h |
| 21 | + | assert_output --partial "usage: git open" |
| 22 | + | } |
| 23 | + | |
| 24 | + | @test "invalid option" { |
| 25 | + | run ../git-open --invalid-option |
| 26 | + | assert_output --partial "error: unknown option \`invalid-option'" |
| 27 | + | assert_output --partial "usage: git open" |
| 28 | + | } |
| 29 | + | |
| 30 | + | ## |
| 31 | + | ## url handling |
| 32 | + | ## |
| 33 | + | |
| 34 | + | @test "url: insteadOf handling" { |
| 35 | + | git config --global url.http://example.com/.insteadOf ex: |
| 36 | + | git remote set-url origin ex:example.git |
| 37 | + | git checkout -B master |
| 38 | + | run ../git-open |
| 39 | + | assert_output "http://example.com/example" |
| 40 | + | } |
| 41 | + | |
| 42 | + | |
| 43 | + | |