Sha256: c4a79a9689112e10976df37ec708315d8b16b1a67146da676c3c2dfc751f099f

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

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

6 entries across 6 versions & 1 rubygems

Version Path
albacore-0.1.5 spec/sftp_spec.rb
albacore-0.1.4 spec/sftp_spec.rb
albacore-0.1.3 spec/sftp_spec.rb
albacore-0.1.2 spec/sftp_spec.rb
albacore-0.1.1 spec/sftp_spec.rb
albacore-0.1.0 spec/sftp_spec.rb