$:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib") require 'spec' require 'buildmaster' require 'buildmaster/cotta' require 'buildmaster/cotta/in_memory_system' module BuildMaster context 'SVN drivers' do setup do @system = InMemorySystem.new cotta = Cotta.new(@system) @work_dir_root = cotta.dir('/workdir') @work_dir_root.dir('.svn').file('entries').save < CONTENT @info = SvnInfo.new @work_dir_root end specify 'load svn info from the .svn directory' do info = SvnInfo.new(@work_dir_root) info.work_dir.should_equal @work_dir_root info.repository_root.should_equal 'svn+ssh://wolfdancer@rubyforge.org/var/svn/buildmaster' end specify 'load svn driver from the root directory' do svn = SvnDriver.from_path(@work_dir_root) svn.command('info') end specify 'svn status command' do log = '' svn = SvnDriver.new(@info) svn.status @system.executed_commands[0].should_equal "svn status #{@work_dir_root.path}" end specify 'svn update command' do log = '' svn = SvnDriver.new(@info) svn.update @system.executed_commands[0].should_equal "svn update #{@work_dir_root.path}" end specify 'svn commit command' do svn = SvnDriver.new(@info) svn.commit('message') @system.executed_commands[0].should_equal "svn commit #{@work_dir_root.path} -m \"message\"" end specify 'svn check out command' do svn = SvnDriver.new(@info) svn.checkout('output') @system.executed_commands[0].should_equal "svn checkout #{@info.repository_root}/trunk output" end specify 'svn command' do svn = SvnDriver.new(@info) svn.command('info') @system.executed_commands[0].should_equal "svn info #{@work_dir_root.path}" end specify 'svn tag' do svn = SvnDriver.new(@info) tag = 'build_0.0.5_b3' svn.tag(tag) @system.executed_commands[0].should_equal "svn copy #{@info.repository_root}/trunk #{@info.repository_root}/tags/#{tag} -m \"ruby buildmaster\"" end end end