Sha256: 2ba327f444ec46e08791b18bd2ef6b37ec6079d55213cae64bf8c3f81c4970da

Contents?: true

Size: 988 Bytes

Versions: 3

Compression:

Stored size: 988 Bytes

Contents

require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
require 'albacore/sftp'

describe Sftp, 'when uploading files over sftp' do
	before :each do
		@sftpstub = Net::SFTP::Session.stub_instance(:upload! => nil)
		Net::SFTP.stub_method(:start).yields(@sftpstub)

		@sftp = Sftp.new
		@sftp.server="server"
		@sftp.username="user"
		@sftp.password="secret"
		
		@sftp.upload_files = {
			"some.file" => "./somefolder/some.file", 
			"another.file" => "another/folder/another.file"
		}
		
		@sftp.upload
	end
	
	it "should attempt to open a connection with the supplied connection information" do
		Net::SFTP.should have_received(:start).with("server", "user", :password => "secret")
	end
	
	it "should upload the local files to the remote destination" do
		@sftpstub.should have_received(:upload!).with("some.file", "./somefolder/some.file")
		@sftpstub.should have_received(:upload!).with("another.file", "another/folder/another.file")
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
albacore-0.0.9 spec/sftp_spec.rb
albacore-0.0.8 spec/sftp_spec.rb
albacore-0.0.7 spec/sftp_spec.rb