Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the gpg_sign commit option (#525)
Signed-off-by: James Couball <jcouball@yahoo.com>
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require File.dirname(__FILE__) + '/../test_helper' | ||
|
||
class TestCommitWithGPG < Test::Unit::TestCase | ||
def setup | ||
set_file_paths | ||
end | ||
|
||
def test_with_configured_gpg_keyid | ||
Dir.mktmpdir do |dir| | ||
git = Git.init(dir) | ||
actual_cmd = nil | ||
git.lib.define_singleton_method(:run_command) do |git_cmd, &block| | ||
actual_cmd = git_cmd | ||
`true` | ||
end | ||
message = 'My commit message' | ||
git.commit(message, gpg_sign: true) | ||
assert_match(/commit.*--gpg-sign['"]/, actual_cmd) | ||
end | ||
end | ||
|
||
def test_with_specific_gpg_keyid | ||
Dir.mktmpdir do |dir| | ||
git = Git.init(dir) | ||
actual_cmd = nil | ||
git.lib.define_singleton_method(:run_command) do |git_cmd, &block| | ||
actual_cmd = git_cmd | ||
`true` | ||
end | ||
message = 'My commit message' | ||
git.commit(message, gpg_sign: 'keykeykey') | ||
assert_match(/commit.*--gpg-sign=keykeykey['"]/, actual_cmd) | ||
end | ||
end | ||
end |