Sha256: 3491589857e8a9efc1e5f37211740cc40033d3d3163c3d3bb483b4348e1a421e
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require 'rubygems' require 'test/unit' require 'mocha' require File.dirname(__FILE__) + '/../../lib/commit_hook' require File.dirname(__FILE__) + '/../../lib/git' class CommitHookTest < Test::Unit::TestCase def test_hook_ignore_merge # 4 commits, one email for each of them, without merge run_with_config('test/fixtures/git-notifier-ignore-merge.yml', 4) end def test_hook_with_merge # 5 commits, one email for each of them, with merge mail run_with_config('test/fixtures/git-notifier-with-merge.yml', 5) end def test_hook_group_email_by_push # 1 commit for the push, all commits in the one message run_with_config('test/fixtures/git-notifier-group-email-by-push.yml', 1) end def run_with_config(config, times) expect_repository_access emailer = mock('Emailer') Emailer.expects(:new).times(times).returns(emailer) emailer.expects(:send).times(times) CommitHook.run config, REVISIONS.first, REVISIONS.last, 'refs/heads/master' end def expect_repository_access path = File.dirname(__FILE__) + '/../fixtures/' Git.expects(:log).with(REVISIONS.first, REVISIONS.last).returns(read_file(path + 'git_log')) Git.expects(:mailing_list_address).returns('recipient@test.com') REVISIONS.each do |rev| Git.expects(:show).with(rev).returns(read_file(path + "git_show_#{rev}")) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git-commit-notifier-0.8.0 | test/unit/test_commit_hook.rb |