Sha256: 1eaf645c420e2aad473831222bf00bd541445f827987e7c5b4e0b395a4f53234

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

require 'helper'

describe Mercurial::BranchFactory do
  
  before do
    @repository = Mercurial::Repository.open(Fixtures.test_repo)
  end
  
  it "should find all branches" do
    branches = @repository.branches.all
    branches.size.must_equal 5
    branches.map(&:name).sort.must_equal %w(branch-from-remote another-branch new-branch old-branch default).sort
    branches.map(&:status).sort.must_equal %w(active active closed active active).sort
  end
  
  it "should find active branches" do
    branches = @repository.branches.active
    branches.size.must_equal 4
    branches.map(&:name).sort.must_equal %w(another-branch new-branch default branch-from-remote).sort
    branches.map(&:status).must_equal %w(active active active active)
  end
  
  it "should find closed branches" do
    branches = @repository.branches.closed
    branches.size.must_equal 1
    branches.map(&:name).must_equal %w(old-branch)
    branches.map(&:status).must_equal %w(closed)
  end
  
  it "should find branch by name" do
    branch = @repository.branches.by_name('new-branch')
    branch.must_be_kind_of(Mercurial::Branch)
    branch.status.must_equal 'active'
  end
  
  it "should not find a branch by inexistent name" do
    @repository.branches.by_name('bla-branch-f').must_equal nil
  end
  
  it "should return branches for commit" do
    branches = @repository.branches.for_commit('bf6386c0a0cc')
    branches.size.must_equal 5
    branches.map(&:name).sort.must_equal %w(old-branch new-branch branch-from-remote another-branch default).sort
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mercurial-ruby-0.6.1 test/test_branch_factory.rb
mercurial-ruby-0.6.0 test/test_branch_factory.rb
mercurial-ruby-0.5.0 test/test_branch_factory.rb
mercurial-ruby-0.4.0 test/test_branch_factory.rb
mercurial-ruby-0.3.0 test/test_branch_factory.rb