Sha256: 96d21070fb5322d8580d3494eed7b27ae7bc5dc3fae9ec4782bf4a559b8ff865

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

$:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib")

require 'test/unit'
require 'buildmaster'

module BuildMaster

class CvsClientTest < Test::Unit::TestCase
  protected
  def setUp() 
    super
  end
  
  private 
  def ensure_folder_exists(path)
    if (not File.exists? path)
      Dir.mkdir(path)      
    end
  end
  
  public
  def test_load_CvsInfo
    folder = 'tmp'
    ensure_folder_exists(folder);
    root = ':ext:wolfdancer@cvsserver.com:/cvs/root'
    repository = 'xpe'
    write("#{folder}/ROOT", root)
    write("#{folder}/Repository", repository)
    cvs = CvsInfo.load(folder)
    assert_equal(root, cvs.root)
    assert_equal(repository, cvs.repository)
  end
  
  def tes_checkout
    log = ''
    client = CvsClient.new(CvsInfo.new('root', 'module'), 'working') {|command| log = command}
    client.checkout
    assert_equal('cvs -d root co -d working module', log)
  end
  
  def test_update
    log = ''
    client = CvsClient.new(CvsInfo.new('root', 'module'), 'working') {|command| log = command}
    client.update
    assert_equal('cvs -d root update working', log)
    client.update('-PAd')
    assert_equal('cvs -d root update -PAd working', log)
  end
  
  def test_command
    log = ''
    client = CvsClient.new(CvsInfo.new('root', 'module'), 'working') {|command| log = command}
    client.command('command -option argument')
    assert_equal('cvs -d root command -option argument working', log)
  end
  
  private 
  def write(fileName, content)
    File.open(fileName, "w") do |file|
      file.puts content
    end
  end

end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
BuildMaster-0.6.0 test/buildmaster/tc_cvs_client.rb