Merge pull request #396 from igor-alexandrov/track-uncommitted-changes

Log uncommitted changes during deploy
This commit is contained in:
Donal McBreen
2023-07-25 14:35:44 +01:00
committed by GitHub
5 changed files with 24 additions and 4 deletions

View File

@@ -84,7 +84,7 @@ class ConfigurationTest < ActiveSupport::TestCase
ENV.delete("VERSION")
@config.expects(:`).with("git rev-parse HEAD").returns("git-version")
@config.expects(:`).with("git status --porcelain").returns("")
Mrsk::Utils.expects(:uncommitted_changes).returns("")
assert_equal "git-version", @config.version
end
@@ -92,7 +92,7 @@ class ConfigurationTest < ActiveSupport::TestCase
ENV.delete("VERSION")
@config.expects(:`).with("git rev-parse HEAD").returns("git-version")
@config.expects(:`).with("git status --porcelain").returns("M file\n")
Mrsk::Utils.expects(:uncommitted_changes).returns("M file\n")
assert_match /^git-version_uncommitted_[0-9a-f]{16}$/, @config.version
end

View File

@@ -61,4 +61,14 @@ class UtilsTest < ActiveSupport::TestCase
assert_equal "\"https://example.com/\\$2\"",
Mrsk::Utils.escape_shell_value("https://example.com/$2")
end
test "uncommitted changes exist" do
Mrsk::Utils.expects(:`).with("git status --porcelain").returns("M file\n")
assert_equal "M file", Mrsk::Utils.uncommitted_changes
end
test "uncommitted changes do not exist" do
Mrsk::Utils.expects(:`).with("git status --porcelain").returns("")
assert_equal "", Mrsk::Utils.uncommitted_changes
end
end