From cdf7b74cbf2610cf7c4faa4eaf82f24cbcc3a4f2 Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 10:40:40 +0200
Subject: [PATCH 01/12] Fix remaining TODO test

---
 tests/commit.bats | 56 ++++++++++++++++++++++++++---------------------
 1 file changed, 31 insertions(+), 25 deletions(-)

diff --git a/tests/commit.bats b/tests/commit.bats
index e75e0f0..5333cac 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -58,39 +58,45 @@ main() {
     [ "${lines[2]}" = "Working tree clean. Nothing to commit." ]
 }
 
-# TODO: Fix Issue where changes in git repo are not detected
-# @test "commit-changed-files-and-push-to-remote" {
+@test "commit-changed-files-and-push-to-remote" {
 
-#     touch "${test_repository}"/new-file-{1,2,3}.txt
+    touch "${test_repository}"/new-file-{1,2,3}.txt
 
-#     shellmock_expect git --type partial --match "status"
-#     shellmock_expect git --type partial --match "checkout"
-#     shellmock_expect git --type partial --match "add"
-#     shellmock_expect git --type partial --match '-c'
-#     shellmock_expect git --type partial --match 'push origin'
+    shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
+    shellmock_expect git --type exact --match "fetch"
+    shellmock_expect git --type exact --match "checkout master"
+    shellmock_expect git --type partial --match "add ."
+    shellmock_expect git --type partial --match '-c'
+    shellmock_expect git --type partial --match 'push --set-upstream origin'
 
-#     run main
+    run main
 
-#     echo "$output"
+    echo "$output"
 
-#     # Success Exit Code
-#     [ "$status" = 0 ]
+    # Success Exit Code
+    [ "$status" = 0 ]
 
-#     [ "${lines[0]}" = "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}" ]
-#     [ "${lines[1]}" = "::set-output name=changes_detected::true" ]
-#     [ "${lines[2]}" = "INPUT_BRANCH value: master" ]
-#     [ "${lines[3]}" = "INPUT_FILE_PATTERN: ." ]
-#     [ "${lines[4]}" = "INPUT_COMMIT_OPTIONS: " ]
-#     [ "${lines[5]}" = "::debug::Apply commit options " ]
+    [ "${lines[0]}" = "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}" ]
+    [ "${lines[1]}" = "::set-output name=changes_detected::true" ]
+    [ "${lines[2]}" = "INPUT_BRANCH value: master" ]
+    [ "${lines[3]}" = "INPUT_FILE_PATTERN: ." ]
+    [ "${lines[4]}" = "INPUT_COMMIT_OPTIONS: " ]
+    [ "${lines[5]}" = "::debug::Apply commit options " ]
+    [ "${lines[6]}" = "INPUT_TAGGING_MESSAGE: " ]
+    [ "${lines[7]}" = "No tagging message supplied. No tag will be added." ]
+    [ "${lines[8]}" = "INPUT_PUSH_OPTIONS: " ]
+    [ "${lines[9]}" = "::debug::Apply push options " ]
+    [ "${lines[10]}" = "::debug::Push commit to remote branch master" ]
 
 
-#     shellmock_verify
-#     [ "${capture[0]}" = "git-stub status -s -- ." ]
-#     [ "${capture[1]}" = "git-stub checkout master" ]
-#     [ "${capture[2]}" = "git-stub add ." ]
-#     [ "${capture[3]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
-#     [ "${capture[4]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
-# }
+    shellmock_verify
+    [ "${capture[0]}" = "git-stub status -s -- ." ]
+    [ "${capture[1]}" = "git-stub fetch" ]
+    [ "${capture[2]}" = "git-stub checkout master" ]
+    [ "${capture[3]}" = "git-stub add ." ]
+    [ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
+    [ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
+}
 
 
 @test "skip-dirty-on-clean-repo-failure" {

From 4f0fc14d0cb5ec08dfa0acf03f4dfd21d2cde5f7 Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 10:40:48 +0200
Subject: [PATCH 02/12] Add shellmock_clean to setup method

---
 tests/commit.bats | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/commit.bats b/tests/commit.bats
index 5333cac..2491b05 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -33,9 +33,16 @@ setup() {
     export INPUT_TAGGING_MESSAGE=""
     export INPUT_PUSH_OPTIONS=""
     export INPUT_SKIP_DIRTY_CHECK=false
+
+    skipIfNot "$BATS_TEST_DESCRIPTION"
+
+    if [ -z "$TEST_FUNCTION" ]; then
+        shellmock_clean
+    fi
 }
 
 teardown() {
+
     if [ -z "$TEST_FUNCTION" ]; then
         shellmock_clean
     fi

From df97d6fbd81c57e7011b0fc61e775a187af2d92d Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 10:40:59 +0200
Subject: [PATCH 03/12] Make testing a single test easier

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index 68fc437..4683c2c 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,6 @@
     "bats": "^1.1.0"
   },
   "scripts": {
-    "test": "bats tests"
+    "test": "rm -rf tests/tmpstubs && rm -rf tests/shellmock.* && bats tests"
   }
 }

From f7e362220d08c67f4ca3c336682d0007ab2ab492 Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 11:19:22 +0200
Subject: [PATCH 04/12] WIP

---
 tests/commit.bats | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/commit.bats b/tests/commit.bats
index 2491b05..adb0ecf 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -105,7 +105,6 @@ main() {
     [ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
 }
 
-
 @test "skip-dirty-on-clean-repo-failure" {
 
     INPUT_SKIP_DIRTY_CHECK=true

From 091b4004198ee7f1bcd63fae4a104ba740e27219 Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 11:19:38 +0200
Subject: [PATCH 05/12] Add git-add-file-pattern-is-applied test

---
 tests/commit.bats | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/commit.bats b/tests/commit.bats
index adb0ecf..dfa560a 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -139,3 +139,37 @@ main() {
     [ "${lines[5]}" = "::debug::Apply commit options " ]
 }
 
+@test "git-add-file-pattern-is-applied" {
+
+    INPUT_FILE_PATTERN="*.txt *.html"
+
+    touch "${test_repository}"/new-file-{1,2}.php
+    touch "${test_repository}"/new-file-{1,2}.html
+
+    shellmock_expect git --type partial --output " M new-file-1.html M new-file-2.html" --match "status"
+    shellmock_expect git --type exact --match "fetch"
+    shellmock_expect git --type exact --match "checkout master"
+    shellmock_expect git --type partial --match "add"
+    shellmock_expect git --type partial --match '-c'
+    shellmock_expect git --type partial --match 'push --set-upstream origin'
+
+    run main
+
+    echo "$output"
+
+    # Success Exit Code
+    [ "$status" = 0 ]
+
+    [ "${lines[3]}" = "INPUT_FILE_PATTERN: *.txt *.html" ]
+    [ "${lines[10]}" = "::debug::Push commit to remote branch master" ]
+
+
+    shellmock_verify
+    [ "${capture[0]}" = "git-stub status -s -- a.txt b.txt c.txt new-file-1.html new-file-2.html" ]
+    [ "${capture[1]}" = "git-stub fetch" ]
+    [ "${capture[2]}" = "git-stub checkout master" ]
+    [ "${capture[3]}" = "git-stub add a.txt b.txt c.txt new-file-1.html new-file-2.html" ]
+    [ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
+    [ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
+}
+

From 0d6d4a4b22f7b52849b24909808285e2e8155fbc Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 11:19:49 +0200
Subject: [PATCH 06/12] Add git-commit-options-are-applied

---
 tests/commit.bats | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tests/commit.bats b/tests/commit.bats
index dfa560a..c2de312 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -173,3 +173,34 @@ main() {
     [ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
 }
 
+@test "git-commit-options-are-applied" {
+
+    INPUT_COMMIT_OPTIONS="--no-verify --signoff"
+
+    touch "${test_repository}"/new-file-{1,2}.txt
+
+    shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt" --match "status"
+    shellmock_expect git --type exact --match "fetch"
+    shellmock_expect git --type exact --match "checkout master"
+    shellmock_expect git --type partial --match "add"
+    shellmock_expect git --type partial --match '-c'
+    shellmock_expect git --type partial --match 'push --set-upstream origin'
+
+    run main
+
+    echo "$output"
+
+    # Success Exit Code
+    [ "$status" = 0 ]
+    [ "${lines[4]}" = "INPUT_COMMIT_OPTIONS: --no-verify --signoff" ]
+    [ "${lines[10]}" = "::debug::Push commit to remote branch master" ]
+
+    shellmock_verify
+    [ "${capture[0]}" = "git-stub status -s -- ." ]
+    [ "${capture[1]}" = "git-stub fetch" ]
+    [ "${capture[2]}" = "git-stub checkout master" ]
+    [ "${capture[3]}" = "git-stub add ." ]
+    [ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com> --no-verify --signoff" ]
+    [ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
+}
+

From b0295737db16c8cd2ed5a87b2cea4aebd66c8bf5 Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 11:20:01 +0200
Subject: [PATCH 07/12] Add commit-user-and-author-settings-are-applied test

---
 tests/commit.bats | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/tests/commit.bats b/tests/commit.bats
index c2de312..57dfd88 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -204,3 +204,36 @@ main() {
     [ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
 }
 
+@test "commit-user-and-author-settings-are-applied" {
+
+    INPUT_COMMIT_USER_NAME="A Single Test"
+    INPUT_COMMIT_USER_EMAIL="single-test@github.com"
+    INPUT_COMMIT_AUTHOR="A Single Test <single@users.noreply.github.com>"
+
+    touch "${test_repository}"/new-file-{1,2}.txt
+
+    shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt" --match "status"
+    shellmock_expect git --type exact --match "fetch"
+    shellmock_expect git --type exact --match "checkout master"
+    shellmock_expect git --type partial --match "add"
+    shellmock_expect git --type partial --match '-c'
+    shellmock_expect git --type partial --match 'push --set-upstream origin'
+
+    run main
+
+    echo "$output"
+
+    # Success Exit Code
+    [ "$status" = 0 ]
+
+    [ "${lines[10]}" = "::debug::Push commit to remote branch master" ]
+
+    shellmock_verify
+    [ "${capture[0]}" = "git-stub status -s -- ." ]
+    [ "${capture[1]}" = "git-stub fetch" ]
+    [ "${capture[2]}" = "git-stub checkout master" ]
+    [ "${capture[3]}" = "git-stub add ." ]
+    [ "${capture[4]}" = "git-stub -c user.name=A Single Test -c user.email=single-test@github.com commit -m Commit Message --author=A Single Test <single@users.noreply.github.com>" ]
+    [ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
+}
+

From 4e16840be428845b96f93445aa3ef31a6f565737 Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 11:20:12 +0200
Subject: [PATCH 08/12] Add can-create-tag test

---
 tests/commit.bats | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/tests/commit.bats b/tests/commit.bats
index 57dfd88..dbc06b1 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -237,3 +237,39 @@ main() {
     [ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
 }
 
+@test "can-create-tag" {
+
+    INPUT_TAGGING_MESSAGE="v1.0.0"
+
+    touch "${test_repository}"/new-file-{1,2,3}.txt
+
+    shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
+    shellmock_expect git --type exact --match "fetch"
+    shellmock_expect git --type exact --match "checkout master"
+    shellmock_expect git --type partial --match "add ."
+    shellmock_expect git --type partial --match '-c'
+    shellmock_expect git --type partial --match 'push --set-upstream origin'
+
+    run main
+
+    echo "$output"
+
+    # Success Exit Code
+    [ "$status" = 0 ]
+
+    [ "${lines[6]}" = "INPUT_TAGGING_MESSAGE: v1.0.0" ]
+    [ "${lines[7]}" = "::debug::Create tag v1.0.0" ]
+    [ "${lines[10]}" = "::debug::Push commit to remote branch master" ]
+
+
+    shellmock_verify
+    [ "${capture[0]}" = "git-stub status -s -- ." ]
+    [ "${capture[1]}" = "git-stub fetch" ]
+    [ "${capture[2]}" = "git-stub checkout master" ]
+    [ "${capture[3]}" = "git-stub add ." ]
+    [ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
+    [ "${capture[5]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com tag -a v1.0.0 -m v1.0.0" ]
+    [ "${capture[6]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
+
+}
+

From cd7c7f1a8ae6b99aa04d014d3280455924362e8a Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 11:20:51 +0200
Subject: [PATCH 09/12] Add git-push-options-are-applied test

---
 tests/commit.bats | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/tests/commit.bats b/tests/commit.bats
index dbc06b1..646138c 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -273,3 +273,38 @@ main() {
 
 }
 
+@test "git-push-options-are-applied" {
+
+    INPUT_PUSH_OPTIONS="--force"
+
+    touch "${test_repository}"/new-file-{1,2,3}.txt
+
+    shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
+    shellmock_expect git --type exact --match "fetch"
+    shellmock_expect git --type exact --match "checkout master"
+    shellmock_expect git --type partial --match "add ."
+    shellmock_expect git --type partial --match '-c'
+    shellmock_expect git --type partial --match 'push --set-upstream origin'
+
+    run main
+
+    echo "$output"
+
+    # Success Exit Code
+    [ "$status" = 0 ]
+
+    [ "${lines[8]}" = "INPUT_PUSH_OPTIONS: --force" ]
+    [ "${lines[9]}" = "::debug::Apply push options --force" ]
+    [ "${lines[10]}" = "::debug::Push commit to remote branch master" ]
+
+
+    shellmock_verify
+    [ "${capture[0]}" = "git-stub status -s -- ." ]
+    [ "${capture[1]}" = "git-stub fetch" ]
+    [ "${capture[2]}" = "git-stub checkout master" ]
+    [ "${capture[3]}" = "git-stub add ." ]
+    [ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
+    [ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags --force" ]
+
+}
+

From ea30556d538781bae5a9e0013cff22f69297e5da Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 11:21:06 +0200
Subject: [PATCH 10/12] Add can-checkout-different-branch test

---
 tests/commit.bats | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/tests/commit.bats b/tests/commit.bats
index 646138c..e033f4a 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -308,3 +308,46 @@ main() {
 
 }
 
+@test "can-checkout-different-branch" {
+
+    INPUT_BRANCH="foo"
+
+    touch "${test_repository}"/new-file-{1,2,3}.txt
+
+    shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
+    shellmock_expect git --type exact --match "fetch"
+    shellmock_expect git --type exact --match "checkout foo"
+    shellmock_expect git --type partial --match "add ."
+    shellmock_expect git --type partial --match '-c'
+    shellmock_expect git --type partial --match 'push --set-upstream origin'
+
+    run main
+
+    echo "$output"
+
+    # Success Exit Code
+    [ "$status" = 0 ]
+
+    [ "${lines[0]}" = "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}" ]
+    [ "${lines[1]}" = "::set-output name=changes_detected::true" ]
+    [ "${lines[2]}" = "INPUT_BRANCH value: foo" ]
+    [ "${lines[3]}" = "INPUT_FILE_PATTERN: ." ]
+    [ "${lines[4]}" = "INPUT_COMMIT_OPTIONS: " ]
+    [ "${lines[5]}" = "::debug::Apply commit options " ]
+    [ "${lines[6]}" = "INPUT_TAGGING_MESSAGE: " ]
+    [ "${lines[7]}" = "No tagging message supplied. No tag will be added." ]
+    [ "${lines[8]}" = "INPUT_PUSH_OPTIONS: " ]
+    [ "${lines[9]}" = "::debug::Apply push options " ]
+    [ "${lines[10]}" = "::debug::Push commit to remote branch foo" ]
+
+
+    shellmock_verify
+    [ "${capture[0]}" = "git-stub status -s -- ." ]
+    [ "${capture[1]}" = "git-stub fetch" ]
+    [ "${capture[2]}" = "git-stub checkout foo" ]
+    [ "${capture[3]}" = "git-stub add ." ]
+    [ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
+    [ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:foo --tags" ]
+
+}
+

From 8bf1b5695aa7e6ad1ea71e598fe5c66f94100025 Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 11:21:16 +0200
Subject: [PATCH 11/12] Add can-work-with-empty-branch-name test

---
 tests/commit.bats | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/tests/commit.bats b/tests/commit.bats
index e033f4a..6bc1c7c 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -351,3 +351,44 @@ main() {
 
 }
 
+@test "can-work-with-empty-branch-name" {
+
+    INPUT_BRANCH=""
+
+    touch "${test_repository}"/new-file-{1,2,3}.txt
+
+    shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
+    shellmock_expect git --type exact --match "fetch"
+    shellmock_expect git --type exact --match "checkout"
+    shellmock_expect git --type partial --match "add ."
+    shellmock_expect git --type partial --match '-c'
+    shellmock_expect git --type partial --match 'push origin'
+
+    run main
+
+    echo "$output"
+
+    # Success Exit Code
+    [ "$status" = 0 ]
+
+    [ "${lines[0]}" = "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}" ]
+    [ "${lines[1]}" = "::set-output name=changes_detected::true" ]
+    [ "${lines[2]}" = "INPUT_BRANCH value: " ]
+    [ "${lines[3]}" = "INPUT_FILE_PATTERN: ." ]
+    [ "${lines[4]}" = "INPUT_COMMIT_OPTIONS: " ]
+    [ "${lines[5]}" = "::debug::Apply commit options " ]
+    [ "${lines[6]}" = "INPUT_TAGGING_MESSAGE: " ]
+    [ "${lines[7]}" = "No tagging message supplied. No tag will be added." ]
+    [ "${lines[8]}" = "INPUT_PUSH_OPTIONS: " ]
+    [ "${lines[9]}" = "::debug::Apply push options " ]
+    [ "${lines[10]}" = "::debug::git push origin" ]
+
+
+    shellmock_verify
+    [ "${capture[0]}" = "git-stub status -s -- ." ]
+    [ "${capture[1]}" = "git-stub fetch" ]
+    [ "${capture[2]}" = "git-stub checkout" ]
+    [ "${capture[3]}" = "git-stub add ." ]
+    [ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
+    [ "${capture[5]}" = "git-stub push origin" ]
+}

From a818c89e49f1866fce6bd0d7a56dc44c5f33fd35 Mon Sep 17 00:00:00 2001
From: Stefan Zweifel <hello@stefanzweifel.io>
Date: Sun, 11 Oct 2020 11:24:53 +0200
Subject: [PATCH 12/12] Add can-work-with-empty-branch-name-and-tags test

---
 tests/commit.bats | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/tests/commit.bats b/tests/commit.bats
index 6bc1c7c..b21ebe2 100644
--- a/tests/commit.bats
+++ b/tests/commit.bats
@@ -392,3 +392,48 @@ main() {
     [ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
     [ "${capture[5]}" = "git-stub push origin" ]
 }
+
+@test "can-work-with-empty-branch-name-and-tags" {
+
+    INPUT_BRANCH=""
+    INPUT_TAGGING_MESSAGE="v2.0.0"
+
+    touch "${test_repository}"/new-file-{1,2,3}.txt
+
+    shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
+    shellmock_expect git --type exact --match "fetch"
+    shellmock_expect git --type exact --match "checkout"
+    shellmock_expect git --type partial --match "add ."
+    shellmock_expect git --type partial --match '-c'
+    shellmock_expect git --type partial --match 'push origin'
+
+    run main
+
+    echo "$output"
+
+    # Success Exit Code
+    [ "$status" = 0 ]
+
+    [ "${lines[0]}" = "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}" ]
+    [ "${lines[1]}" = "::set-output name=changes_detected::true" ]
+    [ "${lines[2]}" = "INPUT_BRANCH value: " ]
+    [ "${lines[3]}" = "INPUT_FILE_PATTERN: ." ]
+    [ "${lines[4]}" = "INPUT_COMMIT_OPTIONS: " ]
+    [ "${lines[5]}" = "::debug::Apply commit options " ]
+    [ "${lines[6]}" = "INPUT_TAGGING_MESSAGE: v2.0.0" ]
+    [ "${lines[7]}" = "::debug::Create tag v2.0.0" ]
+    [ "${lines[8]}" = "INPUT_PUSH_OPTIONS: " ]
+    [ "${lines[9]}" = "::debug::Apply push options " ]
+    [ "${lines[10]}" = "::debug::git push origin --tags" ]
+
+
+    shellmock_verify
+    [ "${capture[0]}" = "git-stub status -s -- ." ]
+    [ "${capture[1]}" = "git-stub fetch" ]
+    [ "${capture[2]}" = "git-stub checkout" ]
+    [ "${capture[3]}" = "git-stub add ." ]
+    [ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
+    [ "${capture[5]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com tag -a v2.0.0 -m v2.0.0" ]
+    [ "${capture[6]}" = "git-stub push origin --tags" ]
+
+}