Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed Sep 16, 2023
1 parent e5886a1 commit e95a9b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,23 @@ class ConfigurationTest < ActiveSupport::TestCase
test "version no git repo" do
ENV.delete("VERSION")

@config.expects(:system).with("git rev-parse").returns(nil)
Kamal::Git.expects(:used?).returns(nil)
error = assert_raises(RuntimeError) { @config.version}
assert_match /no git repository found/, error.message
end

test "version from git committed" do
ENV.delete("VERSION")

@config.expects(:`).with("git rev-parse HEAD").returns("git-version")
Kamal::Git.expects(:revision).returns("git-version")
Kamal::Git.expects(:uncommitted_changes).returns("")
assert_equal "git-version", @config.version
end

test "version from git uncommitted" do
ENV.delete("VERSION")

@config.expects(:`).with("git rev-parse HEAD").returns("git-version")
Kamal::Git.expects(:revision).returns("git-version")
Kamal::Git.expects(:uncommitted_changes).returns("M file\n")
assert_match /^git-version_uncommitted_[0-9a-f]{16}$/, @config.version
end
Expand Down

0 comments on commit e95a9b4

Please sign in to comment.