Commit hash version but not in git

Fixes #11
This commit is contained in:
Adam
2023-02-05 20:31:14 +01:00
parent 9aa57dd0c7
commit 2fe01f13df
2 changed files with 19 additions and 1 deletions

View File

@@ -9,6 +9,16 @@ class CommanderTest < ActiveSupport::TestCase
assert_equal Mrsk::Configuration, @mrsk.config.class
end
test "commit hash as version" do
assert_equal `git rev-parse HEAD`.strip, @mrsk.config.version
end
test "commit hash as version but not in git" do
@mrsk.expects(:system).with("git rev-parse").returns(nil)
error = assert_raises(RuntimeError) { @mrsk.config }
assert_match /no git repository found/, error.message
end
test "overwriting hosts" do
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" ], @mrsk.hosts