Configure Git in tests

This commit is contained in:
Oleg Pykhalov 2020-08-18 22:00:44 +03:00
parent 5755d36c03
commit 2d48b8296d
No known key found for this signature in database
GPG key ID: 167F8EA5001AFA9C

View file

@ -27,6 +27,11 @@
(require 'buttercup) (require 'buttercup)
(require 'git-auto-commit-mode) (require 'git-auto-commit-mode)
(defun gas-test-setup-git ()
(shell-command "git init")
(shell-command "git config user.email user@example.com")
(shell-command "git config user.name \"User Example\""))
(describe "New files" (describe "New files"
(describe "When gac-automatically-add-new-files is t" (describe "When gac-automatically-add-new-files is t"
(it "Should be added to git" (it "Should be added to git"
@ -36,7 +41,7 @@
(default-directory temp-dir)) (default-directory temp-dir))
(unwind-protect (unwind-protect
(progn (progn
(shell-command "git init") (gas-test-setup-git)
(let ((buffer (find-file-noselect temp-file))) (let ((buffer (find-file-noselect temp-file)))
(with-current-buffer buffer (with-current-buffer buffer
(git-auto-commit-mode) (git-auto-commit-mode)
@ -54,7 +59,7 @@
(default-directory temp-dir)) (default-directory temp-dir))
(unwind-protect (unwind-protect
(progn (progn
(shell-command "git init") (gas-test-setup-git)
(let ((buffer (find-file-noselect temp-file))) (let ((buffer (find-file-noselect temp-file)))
(with-current-buffer buffer (with-current-buffer buffer
(git-auto-commit-mode) (git-auto-commit-mode)
@ -71,7 +76,7 @@
(default-directory temp-dir)) (default-directory temp-dir))
(unwind-protect (unwind-protect
(progn (progn
(shell-command "git init") (gas-test-setup-git)
(let ((buffer (find-file-noselect temp-file))) (let ((buffer (find-file-noselect temp-file)))
(with-current-buffer buffer (with-current-buffer buffer
(git-auto-commit-mode) (git-auto-commit-mode)
@ -88,7 +93,7 @@
(mkdir (expand-file-name "test" temp-dir)) (mkdir (expand-file-name "test" temp-dir))
(unwind-protect (unwind-protect
(progn (progn
(shell-command "git init") (gas-test-setup-git)
(let ((buffer (find-file-noselect temp-file))) (let ((buffer (find-file-noselect temp-file)))
(with-current-buffer buffer (with-current-buffer buffer
(git-auto-commit-mode) (git-auto-commit-mode)
@ -104,7 +109,7 @@
(default-directory temp-dir)) (default-directory temp-dir))
(unwind-protect (unwind-protect
(progn (progn
(shell-command "git init") (gas-test-setup-git)
(let ((buffer (find-file-noselect temp-file))) (let ((buffer (find-file-noselect temp-file)))
(with-current-buffer buffer (with-current-buffer buffer
(git-auto-commit-mode) (git-auto-commit-mode)
@ -121,7 +126,7 @@
(mkdir (expand-file-name "[test]-test" temp-dir)) (mkdir (expand-file-name "[test]-test" temp-dir))
(unwind-protect (unwind-protect
(progn (progn
(shell-command "git init") (gas-test-setup-git)
(let ((buffer (find-file-noselect temp-file))) (let ((buffer (find-file-noselect temp-file)))
(with-current-buffer buffer (with-current-buffer buffer
(git-auto-commit-mode) (git-auto-commit-mode)
@ -137,7 +142,7 @@
(default-directory temp-dir)) (default-directory temp-dir))
(unwind-protect (unwind-protect
(progn (progn
(shell-command "git init") (gas-test-setup-git)
(let ((buffer (find-file-noselect temp-file))) (let ((buffer (find-file-noselect temp-file)))
(with-current-buffer buffer (with-current-buffer buffer
(git-auto-commit-mode) (git-auto-commit-mode)
@ -153,7 +158,7 @@
(default-directory temp-dir)) (default-directory temp-dir))
(unwind-protect (unwind-protect
(progn (progn
(shell-command "git init") (gas-test-setup-git)
(let ((buffer (find-file-noselect temp-file))) (let ((buffer (find-file-noselect temp-file)))
(with-current-buffer buffer (with-current-buffer buffer
(git-auto-commit-mode) (git-auto-commit-mode)