$:.unshift File.dirname(__FILE__) + "/../../lib" require File.dirname(__FILE__) + "/../utils" require 'test/unit' require 'switchtower/scm/cvs' class ScmCvsTest < Test::Unit::TestCase class CvsTest < SwitchTower::SCM::Cvs attr_accessor :story attr_reader :last_path def cvs_log(path) @last_path = path story.shift end end class MockChannel attr_reader :sent_data def send_data(data) @sent_data ||= [] @sent_data << data end def [](name) "value" end end class MockActor attr_reader :command attr_reader :channels attr_accessor :story def initialize(config) @config = config end def run(command) @command = command @channels ||= [] @channels << MockChannel.new story.each { |stream, line| yield @channels.last, stream, line } end def release_path (@config[:now] || Time.now.utc).strftime("%Y%m%d%H%M%S") end def method_missing(sym, *args) @config.send(sym, *args) end end def setup @config = MockConfiguration.new @config[:repository] = ":ext:joetester@rubyforge.org:/hello/world" @config[:local] = "/hello/world" @config[:cvs] = "/path/to/cvs" @config[:password] = "chocolatebrownies" @config[:now] = Time.utc(2005,8,24,12,0,0) @scm = CvsTest.new(@config) @actor = MockActor.new(@config) @log_msg = <