Sha256: 1314ef6fe6708d801a018729eb8d871afb16c28552e1899c0e57320d3df9f6a2

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

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

require 'test/unit'
require 'buildmaster'

module BuildMaster

class CvsDriverTest < 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 = CvsDriver.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 = CvsDriver.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 = CvsDriver.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

3 entries across 3 versions & 1 rubygems

Version Path
BuildMaster-0.7.0 test/buildmaster/tc_cvs_driver.rb
BuildMaster-0.8.0 test/buildmaster/tc_cvs_driver.rb
BuildMaster-0.8.1 test/buildmaster/tc_cvs_driver.rb