$:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib") require 'spec' require 'buildmaster' require 'buildmaster/cotta' require 'buildmaster/cotta/in_memory_system' module BuildMaster context 'CvsDriverTest' do setup do @system = InMemorySystem.new @cotta = Cotta.new(@system) @working = @cotta.dir('working') end teardown do @system = nil @cotta = nil @working = nil end specify 'load_CvsInfo' do folder = @cotta.dir('tmp') folder.mkdirs root = ':ext:wolfdancer@cvsserver.com:/cvs/root' repository = 'xpe' folder.file('ROOT').save(root) folder.file('Repository').save(repository) cvs = CvsInfo.load(folder) cvs.root.should_equal root cvs.repository.should_equal repository end specify 'checkout' do client = CvsDriver.new(CvsInfo.new('root', 'module'), @working) client.checkout @system.executed_commands.size.should_equal 1 @system.executed_commands[0].should_equal 'cvs -d root co -d working module' end specify 'update' do log = '' client = CvsDriver.new(CvsInfo.new('root', 'module'), @working) client.update @system.executed_commands.size.should_equal 1 @system.executed_commands[0].should_equal 'cvs -d root update working' client.update('-PAd') @system.executed_commands.size.should_equal 2 @system.executed_commands[1].should_equal 'cvs -d root update -PAd working' end specify 'command' do log = '' client = CvsDriver.new(CvsInfo.new('root', 'module'), @working) client.command('command -option argument') @system.executed_commands.size.should_equal 1 @system.executed_commands[0].should_equal 'cvs -d root command -option argument working' end end end