Skip to content

Commit

Permalink
Add whitespace configuration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKarabaza authored and rultor committed Oct 14, 2017
1 parent 51a5e63 commit 06da133
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/test/git-elegant-configure.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ load commons
load fake-read

setup() {
fake-pass git "config --global core.commentChar" "|"
fake-pass git "config --local core.commentChar" "|"

fake-pass git "config --global user.name" "UserName"
fake-pass git "config --global user.email" "UserEmail"

fake-pass git "config --global core.commentChar"
fake-pass git "config --local core.commentChar"

fake-pass git "config --global user.name UserName"
fake-pass git "config --global user.email UserEmail"
fake-pass git "config --local user.name UserName"
fake-pass git "config --local user.email UserEmail"

fake-pass git "config --global apply.whitespace fix"
fake-pass git "config --local apply.whitespace fix"
}

@test "'configure': exit code is 11 when run without arguments" {
Expand All @@ -34,16 +37,18 @@ setup() {

@test "'configure': sequence of the configuration is correct when run with '--global' argument" {
run git-elegant configure --global
[[ "${lines[0]}" =~ "commit message won't start with [|]:" ]]
[[ "${lines[1]}" =~ "your user name [UserName]:" ]]
[[ "${lines[2]}" =~ "your user email [UserEmail]:" ]]
[ ${#lines[@]} == 3 ]
[ "${lines[0]}" = "commit message won't start with [|]: " ]
[ "${lines[1]}" = "your user name [UserName]: " ]
[ "${lines[2]}" = "your user email [UserEmail]: " ]
[ "${lines[3]}" = "whitespace issues on patching [fix]: " ]
[ ${#lines[@]} -eq 4 ]
}

@test "'configure': sequence of the configuration is correct when run with '--local' argument" {
run git-elegant configure --local
[[ "${lines[0]}" =~ "commit message won't start with [|]:" ]]
[[ "${lines[1]}" =~ "your user name [UserName]:" ]]
[[ "${lines[2]}" =~ "your user email [UserEmail]:" ]]
[ ${#lines[@]} == 3 ]
[ "${lines[0]}" = "commit message won't start with [|]: " ]
[ "${lines[1]}" = "your user name [UserName]: " ]
[ "${lines[2]}" = "your user email [UserEmail]: " ]
[ "${lines[3]}" = "whitespace issues on patching [fix]: " ]
[ ${#lines[@]} -eq 4 ]
}

0 comments on commit 06da133

Please sign in to comment.