test/yads/test_deployer.rb in yads-0.1.1 vs test/yads/test_deployer.rb in yads-0.1.2

- old
+ new

@@ -33,10 +33,22 @@ deployer = Yads::Deployer.new(@log_file) deployer.setup end end + def test_setup_using_non_standard_port + inside_project_root do + ssh = mock + ssh.expects(:execute).with("mkdir -p /tmp/yads && cd /tmp/yads && git clone --depth 1 git@repohost.com:myrepo.git .") + Yads::SSH.expects(:new).with(:host => "rafaelss.com", :user => "deploy", :forward_agent => true, :port => 2222).returns(ssh) + + deployer = Yads::Deployer.new(@log_file) + deployer.stubs(:config => YAML.load(File.open("config/deploy_with_port.yml")).merge("port" => 2222)) + deployer.setup + end + end + def test_deploy inside_project_root do ssh = mock ssh.expects(:execute).with("cd /tmp/yads && rake db:migrate && touch test") Yads::SSH.expects(:new).with(:host => "rafaelss.com", :user => "deploy", :forward_agent => true).returns(ssh) @@ -44,11 +56,23 @@ deployer = Yads::Deployer.new(@log_file) deployer.deploy end end - private + def test_deploy_using_non_standard_port + inside_project_root do + ssh = mock + ssh.expects(:execute).with("cd /tmp/yads && rake db:migrate && touch test") + Yads::SSH.expects(:new).with(:host => "rafaelss.com", :user => "deploy", :forward_agent => true, :port => 2222).returns(ssh) - def inside_project_root(&block) - Dir.chdir(File.expand_path("../../fixtures", __FILE__), &block) + deployer = Yads::Deployer.new(@log_file) + deployer.stubs(:config => YAML.load(File.open("config/deploy_with_port.yml")).merge("port" => 2222)) + deployer.deploy end + end + + private + + def inside_project_root(&block) + Dir.chdir(File.expand_path("../../fixtures", __FILE__), &block) + end end