diff options
author | Jamis Buck <jamis@37signals.com> | 2005-08-30 20:53:32 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-08-30 20:53:32 +0000 |
commit | 6b1864a048ffb9343d4658ec11c32494d7f038db (patch) | |
tree | 6c1ad3f9131d644afab6cc6188001cfb73775e33 /switchtower/test/scm/subversion_test.rb | |
parent | bb7f60ca1cd191fd775fef261b4d2bc7af223604 (diff) | |
download | rails-6b1864a048ffb9343d4658ec11c32494d7f038db.tar.gz rails-6b1864a048ffb9343d4658ec11c32494d7f038db.tar.bz2 rails-6b1864a048ffb9343d4658ec11c32494d7f038db.zip |
Move switchtower to the tools directory, to decouple it from rails
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2074 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'switchtower/test/scm/subversion_test.rb')
-rw-r--r-- | switchtower/test/scm/subversion_test.rb | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/switchtower/test/scm/subversion_test.rb b/switchtower/test/scm/subversion_test.rb deleted file mode 100644 index fa65714b6b..0000000000 --- a/switchtower/test/scm/subversion_test.rb +++ /dev/null @@ -1,100 +0,0 @@ -$:.unshift File.dirname(__FILE__) + "/../../lib" - -require File.dirname(__FILE__) + "/../utils" -require 'test/unit' -require 'switchtower/scm/subversion' - -class ScmSubversionTest < Test::Unit::TestCase - class SubversionTest < SwitchTower::SCM::Subversion - attr_accessor :story - attr_reader :last_path - - def svn_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 method_missing(sym, *args) - @config.send(sym, *args) - end - end - - def setup - @config = MockConfiguration.new - @config[:repository] = "/hello/world" - @config[:svn] = "/path/to/svn" - @config[:password] = "chocolatebrownies" - @scm = SubversionTest.new(@config) - @actor = MockActor.new(@config) - @log_msg = <<MSG.strip ------------------------------------------------------------------------- -r1967 | minam | 2005-08-03 06:59:03 -0600 (Wed, 03 Aug 2005) | 2 lines - -Initial commit of the new switchtower utility - ------------------------------------------------------------------------- -MSG - @scm.story = [ @log_msg ] - end - - def test_latest_revision - @scm.story = [ @log_msg ] - assert_equal "1967", @scm.latest_revision - assert_equal "/hello/world", @scm.last_path - end - - def test_latest_revision_searching_upwards - @scm.story = [ "-----------------------------\n", @log_msg ] - assert_equal "1967", @scm.latest_revision - assert_equal "/hello", @scm.last_path - end - - def test_checkout - @actor.story = [] - assert_nothing_raised { @scm.checkout(@actor) } - assert_nil @actor.channels.last.sent_data - assert_match %r{/path/to/svn}, @actor.command - end - - def test_checkout_needs_ssh_password - @actor.story = [[:out, "Password: "]] - assert_nothing_raised { @scm.checkout(@actor) } - assert_equal ["chocolatebrownies\n"], @actor.channels.last.sent_data - end - - def test_checkout_needs_http_password - @actor.story = [[:out, "Password for (something): "]] - assert_nothing_raised { @scm.checkout(@actor) } - assert_equal ["chocolatebrownies\n"], @actor.channels.last.sent_data - end -end |