Sha256: 6ee8960946e0a60bfada40da0f6524026d60e7cbe489111751f7c66b0bc011fc

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

require File.dirname(__FILE__) + '/helper'

describe Mercurial::HookFactory do
  
  before do
    @repository = Mercurial::Repository.create('/tmp/configfile-test.hg')    
    stub_hgrc(@repository.config.path)
  end
  
  after do
    @repository.destroy!
  end
  
  it "should find all hooks" do
    hooks = @repository.hooks.all
    hooks.size.must_equal 2
    hooks.map(&:name).must_equal ['commit', 'changegroup']
    hooks.map(&:value).must_equal ['/Users/ilya/work/beanstalk/script/mercurial/commit.rb', '/Users/ilya/work/beanstalk/script/mercurial/changegroup.rb']
    hooks.first.must_be_kind_of Mercurial::Hook
  end
  
  it "should find hooks by name" do
    hook = @repository.hooks.by_name('changegroup')
    hook.must_be_kind_of Mercurial::Hook
    hook.name.must_equal 'changegroup'
    hook.value.must_equal '/Users/ilya/work/beanstalk/script/mercurial/changegroup.rb'
  end
  
  it "should create hooks" do
    hook = @repository.hooks.add('incoming', 'hg update')
    hook.name.must_equal 'incoming'
    hook.value.must_equal 'hg update'
  end
  
  it "should destroy hooks" do
    Mercurial::Hook.any_instance.expects(:destroy!).once
    @repository.hooks.remove('commit')
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mercurial-ruby-0.7.7 test/test_hook_factory.rb
mercurial-ruby-0.7.6 test/test_hook_factory.rb
mercurial-ruby-0.7.5 test/test_hook_factory.rb
mercurial-ruby-0.7.4 test/test_hook_factory.rb
mercurial-ruby-0.7.3 test/test_hook_factory.rb
mercurial-ruby-0.7.2 test/test_hook_factory.rb