File: test_commit_with_empty_message.rb

package info (click to toggle)
ruby-git 1.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,124 kB
  • sloc: ruby: 5,385; sh: 507; perl: 64; makefile: 6
file content (25 lines) | stat: -rwxr-xr-x 603 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../test_helper'

class TestCommitWithEmptyMessage < Test::Unit::TestCase
  def setup
    set_file_paths
  end

  def test_without_allow_empty_message_option
    Dir.mktmpdir do |dir|
      git = Git.init(dir)
      assert_raises Git::GitExecuteError do
        git.commit('', { allow_empty: true })
      end
    end
  end

  def test_with_allow_empty_message_option
    Dir.mktmpdir do |dir|
      git = Git.init(dir)
      git.commit('', { allow_empty: true, allow_empty_message: true})
      assert_equal(1, git.log.to_a.size)
    end
  end
end