Extract Kamal::Git as gateway for all git usage
This commit is contained in:
@@ -84,7 +84,7 @@ class ConfigurationTest < ActiveSupport::TestCase
|
||||
ENV.delete("VERSION")
|
||||
|
||||
@config.expects(:`).with("git rev-parse HEAD").returns("git-version")
|
||||
Kamal::Utils.expects(:uncommitted_changes).returns("")
|
||||
Kamal::Git.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")
|
||||
Kamal::Utils.expects(:uncommitted_changes).returns("M file\n")
|
||||
Kamal::Git.expects(:uncommitted_changes).returns("M file\n")
|
||||
assert_match /^git-version_uncommitted_[0-9a-f]{16}$/, @config.version
|
||||
end
|
||||
|
||||
|
||||
13
test/git_test.rb
Normal file
13
test/git_test.rb
Normal 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
|
||||
@@ -141,14 +141,4 @@ class UtilsTest < ActiveSupport::TestCase
|
||||
assert_equal "\"https://example.com/\\$2\"",
|
||||
Kamal::Utils.escape_shell_value("https://example.com/$2")
|
||||
end
|
||||
|
||||
test "uncommitted changes exist" do
|
||||
Kamal::Utils.expects(:`).with("git status --porcelain").returns("M file\n")
|
||||
assert_equal "M file", Kamal::Utils.uncommitted_changes
|
||||
end
|
||||
|
||||
test "uncommitted changes do not exist" do
|
||||
Kamal::Utils.expects(:`).with("git status --porcelain").returns("")
|
||||
assert_equal "", Kamal::Utils.uncommitted_changes
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user