mirror of
				https://github.com/capistrano/capistrano
				synced 2023-03-27 23:21:18 -04:00 
			
		
		
		
	make sure :mode parameter to upload() is honored
This commit is contained in:
		
							parent
							
								
									c1e927989b
								
							
						
					
					
						commit
						9be48bd0b0
					
				
					 3 changed files with 27 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -14,7 +14,8 @@ class ConfigurationActionsFileTransferTest < Test::Unit::TestCase
 | 
			
		|||
 | 
			
		||||
  def test_put_should_delegate_to_upload
 | 
			
		||||
    @config.expects(:upload).with { |from, to, opts|
 | 
			
		||||
      from.string == "some data" && to == "test.txt" && opts == { :permissions => 0777 } }
 | 
			
		||||
      from.string == "some data" && to == "test.txt" && opts == { :mode => 0777 } }
 | 
			
		||||
    @config.expects(:run).never
 | 
			
		||||
    @config.put("some data", "test.txt", :mode => 0777)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -28,6 +29,24 @@ class ConfigurationActionsFileTransferTest < Test::Unit::TestCase
 | 
			
		|||
    @config.upload("testl.txt", "testr.txt", :foo => "bar")
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_upload_without_mode_should_not_try_to_chmod
 | 
			
		||||
    @config.expects(:transfer).with(:up, "testl.txt", "testr.txt", :foo => "bar")
 | 
			
		||||
    @config.expects(:run).never
 | 
			
		||||
    @config.upload("testl.txt", "testr.txt", :foo => "bar")
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_upload_with_mode_should_try_to_chmod
 | 
			
		||||
    @config.expects(:transfer).with(:up, "testl.txt", "testr.txt", :foo => "bar")
 | 
			
		||||
    @config.expects(:run).with("chmod 775 testr.txt")
 | 
			
		||||
    @config.upload("testl.txt", "testr.txt", :mode => 0775, :foo => "bar")
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_upload_with_symbolic_mode_should_try_to_chmod
 | 
			
		||||
    @config.expects(:transfer).with(:up, "testl.txt", "testr.txt", :foo => "bar")
 | 
			
		||||
    @config.expects(:run).with("chmod g+w testr.txt")
 | 
			
		||||
    @config.upload("testl.txt", "testr.txt", :mode => "g+w", :foo => "bar")
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_download_should_delegate_to_transfer
 | 
			
		||||
    @config.expects(:transfer).with(:down, "testr.txt", "testl.txt", :foo => "bar")
 | 
			
		||||
    @config.download("testr.txt", "testl.txt", :foo => "bar")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue