Sha256: 13035a77e4a5903b7e6522f25eb43e656352fc6a5fc0c18238ef7a10b8017019

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

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

describe Albacore::SftpTask, "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
		task = Albacore::SftpTask.new() do |t|
			@yielded_object = t
		end
		task.extend(TasklibPatch)
		Rake::Task[:sftp].invoke
	end
	
	it "should yield the sftp api" do
		@yielded_object.kind_of?(Sftp).should == true 
	end
end

describe Albacore::SftpTask, "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
		@task = Albacore::SftpTask.new(:failingtask)
		@task.extend(TasklibPatch)
		@task.fail
		Rake::Task["failingtask"].invoke
	end
	
	it "should fail the rake task" do
		@task.task_failed.should be_true
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
albacore-0.0.7 spec/sftptask_spec.rb