diff --git a/src/test/git-elegant-check.bats b/src/test/git-elegant-check.bats index 6a1d2a5..d54948f 100644 --- a/src/test/git-elegant-check.bats +++ b/src/test/git-elegant-check.bats @@ -5,6 +5,7 @@ load commons setup() { fake-pass git "diff --check" fake-pass git "diff --cached --check" + fake-pass git "elegant check --all" } @test "exit code is 0 when run 'git-elegant check -a'" { diff --git a/src/test/git-elegant-clear-local.bats b/src/test/git-elegant-clear-local.bats index 8f8c0fd..c8fbfcc 100644 --- a/src/test/git-elegant-clear-local.bats +++ b/src/test/git-elegant-clear-local.bats @@ -5,9 +5,7 @@ load fake-read setup() { fake-pass git "branch -lvv" "first [gone]" - fake-pass git "checkout master" - fake-pass git "fetch --tags" - fake-pass git pull + fake-pass git "elegant pull master" fake-pass git "branch -d first" } diff --git a/src/test/git-elegant-feature.bats b/src/test/git-elegant-feature.bats index bedca0b..6ac8f2c 100644 --- a/src/test/git-elegant-feature.bats +++ b/src/test/git-elegant-feature.bats @@ -3,12 +3,9 @@ load commons setup() { - fake-pass git "checkout master" - fake-pass git "fetch --tags" - fake-pass git pull + fake-pass git "elegant pull master" fake-pass git "checkout -b test-feature" fake-pass git "stash save elegant-git" - fake-pass git "stash apply stash^{/elegant-git}" } @test "exit code is 0 when run 'git-elegant feature test-feature'" { @@ -28,6 +25,7 @@ setup() { @test "exit code is 0 when run 'git-elegant feature' with changes" { fake-pass git "stash save elegant-git" "Saved working directory" + fake-pass git "stash apply stash^{/elegant-git}" fake-pass git "stash drop stash@{0}" run git-elegant feature test-feature [ "$status" -eq 0 ] @@ -41,6 +39,7 @@ setup() { @test "exit code is 100 when run 'git-elegant feature' with error at 'git stash drop'" { fake-pass git "stash save elegant-git" "Saved working directory" + fake-pass git "stash apply stash^{/elegant-git}" fake-fail git "stash drop stash@{0}" run git-elegant feature test-feature [ "$status" -eq 100 ] diff --git a/src/test/git-elegant-push-after-rebase.bats b/src/test/git-elegant-push-after-rebase.bats index ba765b2..20d19e0 100644 --- a/src/test/git-elegant-push-after-rebase.bats +++ b/src/test/git-elegant-push-after-rebase.bats @@ -4,10 +4,8 @@ load commons load fake-read setup() { - fake-pass git branch *master - fake-pass git "push -u origin master:master" - fake-pass git "fetch --tags" - fake-pass git "rebase origin/master" + fake-pass git "elegant rebase" + fake-pass git "elegant push" } @test "exit code is 0 when run 'git-elegant push-after-rebase'" { diff --git a/src/test/git-elegant.bats b/src/test/git-elegant.bats index f56f204..ba906af 100644 --- a/src/test/git-elegant.bats +++ b/src/test/git-elegant.bats @@ -4,24 +4,24 @@ load commons @test "print available commands when run 'git-elegant commands'" { run git-elegant commands - [[ "${lines[0]}" =~ "feature" ]] - [[ "${lines[1]}" =~ "pull" ]] - [[ "${lines[2]}" =~ "push" ]] - [[ "${lines[3]}" =~ "push-after-rebase" ]] - [[ "${lines[4]}" =~ "rebase" ]] - [[ "${lines[5]}" =~ "init" ]] - [[ "${lines[6]}" =~ "clone" ]] - [[ "${lines[7]}" =~ "add" ]] - [[ "${lines[8]}" =~ "clear-local" ]] - [[ "${lines[9]}" =~ "configure" ]] - [[ "${lines[10]}" =~ "check" ]] + [ "${lines[0]}" = "feature" ] + [ "${lines[1]}" = "pull" ] + [ "${lines[2]}" = "push" ] + [ "${lines[3]}" = "push-after-rebase" ] + [ "${lines[4]}" = "rebase" ] + [ "${lines[5]}" = "init" ] + [ "${lines[6]}" = "clone" ] + [ "${lines[7]}" = "add" ] + [ "${lines[8]}" = "clear-local" ] + [ "${lines[9]}" = "configure" ] + [ "${lines[10]}" = "check" ] [ ${#lines[@]} -eq 11 ] } @test "exit code is 10 when run 'git-elegant'" { + fake-pass git "elegant commands" run git-elegant - echo $status [ "$status" -eq 10 ] }