Projects STRLCPY git-open Commits f80f7ba2
🤬
  • ■ ■ ■ ■ ■
    test/git-open.bats
    1 1  #!/usr/bin/env bats
    2 2   
    3  -load "test_helper/bats-support/load"
    4  -load "test_helper/bats-assert/load"
    5  - 
    6  -foldername="sandboxrepo"
    7  - 
    8  -setup() {
    9  - create_git_sandbox
    10  - export BROWSER=echo
    11  -}
     3 +load "test_helper/index"
    12 4   
    13 5  ##
    14 6  ## Test environment
    skipped 374 lines
    389 381   assert_output "http://tfs.example.com:8080/Project/Folder/_workitems?id=36"
    390 382  }
    391 383   
    392  - 
    393  -teardown() {
    394  - cd ..
    395  - rm -rf "$foldername"
    396  -}
    397  - 
    398  -# helper to create a test git sandbox that won't dirty the real repo
    399  -function create_git_sandbox() {
    400  - rm -rf "$foldername"
    401  - mkdir "$foldername"
    402  - cd "$foldername"
    403  - # safety check. Don't muck with the git repo if we're not inside the sandbox.
    404  - assert_equal $(basename $PWD) "$foldername"
    405  - 
    406  - git init -q
    407  - assert [ -e "../$foldername/.git" ]
    408  - git config user.email "[email protected]" && git config user.name "Test Runner"
    409  - 
    410  - # newer git auto-creates the origin remote
    411  - if ! git remote add origin "github.com:paulirish/git-open.git"; then
    412  - git remote set-url origin "github.com:paulirish/git-open.git"
    413  - fi
    414  - 
    415  - git checkout -B "master"
    416  - 
    417  - echo "ok" > readme.txt
    418  - git add readme.txt
    419  - git commit -m "add file" -q
    420  -}
    421  - 
  • ■ ■ ■ ■ ■ ■
    test/test_helper/index.bash
     1 +#!/usr/bin/env bats
     2 + 
     3 +load "test_helper/bats-support/load"
     4 +load "test_helper/bats-assert/load"
     5 + 
     6 +foldername="sandboxrepo"
     7 + 
     8 +setup() {
     9 + create_git_sandbox
     10 + export BROWSER=echo
     11 +}
     12 + 
     13 +teardown() {
     14 + cd ..
     15 + rm -rf "$foldername"
     16 +}
     17 + 
     18 +# helper to create a test git sandbox that won't dirty the real repo
     19 +function create_git_sandbox() {
     20 + rm -rf "$foldername"
     21 + mkdir "$foldername"
     22 + cd "$foldername"
     23 + # safety check. Don't muck with the git repo if we're not inside the sandbox.
     24 + assert_equal $(basename $PWD) "$foldername"
     25 + 
     26 + git init -q
     27 + assert [ -e "../$foldername/.git" ]
     28 + git config user.email "[email protected]" && git config user.name "Test Runner"
     29 + 
     30 + # newer git auto-creates the origin remote
     31 + if ! git remote add origin "github.com:paulirish/git-open.git"; then
     32 + git remote set-url origin "github.com:paulirish/git-open.git"
     33 + fi
     34 + 
     35 + git checkout -B "master"
     36 + 
     37 + echo "ok" > readme.txt
     38 + git add readme.txt
     39 + git commit -m "add file" -q
     40 +}
     41 + 
Please wait...
Page is in error, reload to recover