test/yads/test_deployer.rb in yads-0.1.2 vs test/yads/test_deployer.rb in yads-0.2.0
- old
+ new
@@ -68,9 +68,34 @@
deployer.stubs(:config => YAML.load(File.open("config/deploy_with_port.yml")).merge("port" => 2222))
deployer.deploy
end
end
+ def test_command_names
+ inside_project_root do
+ deployer = Yads::Deployer.new(@log_file)
+ assert_equal ["migrate", "touch"], deployer.command_names
+ end
+ end
+
+ def test_respond_to_command
+ inside_project_root do
+ deployer = Yads::Deployer.new(@log_file)
+ assert deployer.respond_to?(:migrate), "Deployer does not respond to :migrate"
+ end
+ end
+
+ def test_execute_the_command
+ inside_project_root do
+ ssh = mock
+ ssh.expects(:execute).with("cd /tmp/yads && rake db:migrate")
+ Yads::SSH.expects(:new).with(:host => "rafaelss.com", :user => "deploy", :forward_agent => true).returns(ssh)
+
+ deployer = Yads::Deployer.new(@log_file)
+ deployer.migrate
+ end
+ end
+
private
def inside_project_root(&block)
Dir.chdir(File.expand_path("../../fixtures", __FILE__), &block)
end