Sha256: 63166741f37c4d1fefbe9282d914bbf87677a077355965a6004ebfe9b3c289dc

Contents?: true

Size: 979 Bytes

Versions: 4

Compression:

Stored size: 979 Bytes

Contents

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

describe "when running" do
  before :all do
    @sftpstub = Net::SFTP::Session.stub_instance(:upload! => nil)
    Net::SFTP.stub_method(:start).yields(@sftpstub)
  end
  
  before :each do
    sftp :sftp do |t|
      t.extend(FailPatch)
      @yielded_object = t
    end
    Rake::Task[:sftp].invoke
  end
  
  it "should yield the sftp api" do
    @yielded_object.kind_of?(Sftp).should == true 
  end
end

describe "when execution fails" do
  before :all do
    @sftpstub = Net::SFTP::Session.stub_instance(:upload! => nil)
    Net::SFTP.stub_method(:start).yields(@sftpstub)
  end
  
  before :each do
    sftp :sftp_fail do |t|
      t.extend(FailPatch)
      t.fail
    end
    Rake::Task[:sftp_fail].invoke
  end
  
  it "should fail the rake task" do
    $task_failed.should be_true
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
albacore-0.1.5 spec/sftptask_spec.rb
albacore-0.1.4 spec/sftptask_spec.rb
albacore-0.1.3 spec/sftptask_spec.rb
albacore-0.1.2 spec/sftptask_spec.rb