aboutsummaryrefslogtreecommitdiffstats
path: root/switchtower/test/actor_test.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-08-06 19:35:25 +0000
committerJamis Buck <jamis@37signals.com>2005-08-06 19:35:25 +0000
commit5e558bcbf09058d1532db05350c3949333839f16 (patch)
tree2afbd469b29b924ff009f267f5036f3d08fc1080 /switchtower/test/actor_test.rb
parent25ce9f3bc95dc8aceb8bd51dd3786ae9e0fdfa17 (diff)
downloadrails-5e558bcbf09058d1532db05350c3949333839f16.tar.gz
rails-5e558bcbf09058d1532db05350c3949333839f16.tar.bz2
rails-5e558bcbf09058d1532db05350c3949333839f16.zip
When executing multiline commands, escape newlines with a backslash
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1975 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'switchtower/test/actor_test.rb')
-rw-r--r--switchtower/test/actor_test.rb47
1 files changed, 26 insertions, 21 deletions
diff --git a/switchtower/test/actor_test.rb b/switchtower/test/actor_test.rb
index bc33750b83..ed657ee26e 100644
--- a/switchtower/test/actor_test.rb
+++ b/switchtower/test/actor_test.rb
@@ -5,28 +5,24 @@ require 'test/unit'
require 'switchtower/actor'
require 'switchtower/logger'
-module SwitchTower
- class Actor
- attr_reader :factory
+class ActorTest < Test::Unit::TestCase
- class DefaultConnectionFactory
- def connect_to(server)
- server
- end
+ class TestingConnectionFactory
+ def initialize(config)
end
- class GatewayConnectionFactory
- def connect_to(server)
- server
- end
+ def connect_to(server)
+ server
end
+ end
- def establish_gateway
- GatewayConnectionFactory.new
+ class GatewayConnectionFactory
+ def connect_to(server)
+ server
end
end
- class Command
+ class TestingCommand
def self.invoked!
@invoked = true
end
@@ -46,9 +42,18 @@ module SwitchTower
self.class.invoked!
end
end
-end
-class ActorTest < Test::Unit::TestCase
+ class TestActor < SwitchTower::Actor
+ attr_reader :factory
+
+ self.connection_factory = TestingConnectionFactory
+ self.command_factory = TestingCommand
+
+ def establish_gateway
+ GatewayConnectionFactory.new
+ end
+ end
+
class MockConfiguration
Role = Struct.new(:host, :options)
@@ -79,8 +84,8 @@ class ActorTest < Test::Unit::TestCase
end
def setup
- SwitchTower::Command.reset!
- @actor = SwitchTower::Actor.new(MockConfiguration.new)
+ TestingCommand.reset!
+ @actor = TestActor.new(MockConfiguration.new)
end
def test_define_task_creates_method
@@ -203,7 +208,7 @@ class ActorTest < Test::Unit::TestCase
end
@actor.foo
- assert_instance_of SwitchTower::Actor::GatewayConnectionFactory, @actor.factory
+ assert_instance_of GatewayConnectionFactory, @actor.factory
end
def test_run_when_not_pretend
@@ -213,7 +218,7 @@ class ActorTest < Test::Unit::TestCase
@actor.configuration.pretend = false
@actor.foo
- assert SwitchTower::Command.invoked?
+ assert TestingCommand.invoked?
end
def test_run_when_pretend
@@ -223,7 +228,7 @@ class ActorTest < Test::Unit::TestCase
@actor.configuration.pretend = true
@actor.foo
- assert !SwitchTower::Command.invoked?
+ assert !TestingCommand.invoked?
end
def test_task_before_hook