Sha256: b33cd0429c3591e987cd1493374dbf7d05bf14896b9ef2a3f3885260226e2421

Contents?: true

Size: 1023 Bytes

Versions: 4

Compression:

Stored size: 1023 Bytes

Contents

require 'helper'

describe Mercurial::Hook do
  
  before do
    @repository = Mercurial::Repository.create('/tmp/test-hg-repo')
    stub_hgrc(@repository.config.path)
    @hook = @repository.hooks.by_name('changegroup')    
  end
  
  after do
    @repository.destroy!
  end
  
  it "should have name" do
    @hook.name.must_equal 'changegroup'
  end
  
  it "should have value" do
    @hook.value.must_equal '/Users/ilya/work/beanstalk/script/mercurial/changegroup.rb'
  end
  
  it "should have repository" do
    @hook.repository.must_equal @repository
  end
  
  it "should add itself to the config" do
    hook = Mercurial::Hook.new(@repository, 'outcoming', 'hg update')
    hook.save
    @repository.hooks.by_name('outcoming').value.must_equal 'hg update'
  end
  
  it "should remove itself from the config" do
    @hook.destroy!
    @repository.hooks.by_name('changegroup').must_equal nil
    @repository.hooks.by_name('commit').value.must_equal '/Users/ilya/work/beanstalk/script/mercurial/commit.rb'
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mercurial-ruby-0.7.1 test/test_hook.rb
mercurial-ruby-0.7.0 test/test_hook.rb
mercurial-ruby-0.6.1 test/test_hook.rb
mercurial-ruby-0.6.0 test/test_hook.rb