Sha256: 04466b84e418f9e266242a2ae8bd3fb026fc61e4a9267d9d2fb80b922976155c

Contents?: true

Size: 924 Bytes

Versions: 1

Compression:

Stored size: 924 Bytes

Contents

require_relative '../test_helper'

module OhlohScm::Adapters
	class GitCommitAllTest < Scm::Test

		def test_commit_all
			Scm::ScratchDir.new do |dir|
				git = GitAdapter.new(:url => dir).normalize

				git.init_db
				assert !git.anything_to_commit?

				File.open(File.join(dir, 'README'), 'w') {}
				assert git.anything_to_commit?

				c = Scm::Commit.new
				c.author_name = "John Q. Developer"
				c.message = "Initial checkin."
				git.commit_all(c)
				assert !git.anything_to_commit?

				assert_equal 1, git.commits.size

				assert_equal c.author_name, git.commits.first.author_name
				# Depending on version of Git used, we may or may not have trailing \n.
				# We don't really care, so just compare the stripped versions.
				assert_equal c.message.strip, git.commits.first.message.strip

				assert_equal ['.gitignore', 'README'], git.commits.first.diffs.collect { |d| d.path }.sort
			end
		end

	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ohloh_scm-2.0.0 test/unit/git_commit_all_test.rb