Extract Kamal::Git as gateway for all git usage

This commit is contained in:
dhh
2023-09-16 11:30:29 -07:00
parent 12a82a6c58
commit cfbfb37e23
8 changed files with 38 additions and 22 deletions

13
test/git_test.rb Normal file
View File

@@ -0,0 +1,13 @@
require "test_helper"
class GitTest < ActiveSupport::TestCase
test "uncommitted changes exist" do
Kamal::Git.expects(:`).with("git status --porcelain").returns("M file\n")
assert_equal "M file", Kamal::Git.uncommitted_changes
end
test "uncommitted changes do not exist" do
Kamal::Git.expects(:`).with("git status --porcelain").returns("")
assert_equal "", Kamal::Git.uncommitted_changes
end
end