1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

fix the tests, too

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@7879 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2007-10-14 14:51:41 +00:00
parent 2570b78819
commit a1b823e20e

View file

@ -33,7 +33,7 @@ class UploadTest < Test::Unit::TestCase
def test_process_when_sftp_open_fails_should_raise_error def test_process_when_sftp_open_fails_should_raise_error
sftp = mock_sftp sftp = mock_sftp
sftp.expects(:open).with("test.txt", @mode, 0660).yields(mock("status", :code => "bad status", :message => "bad status"), :file_handle) sftp.expects(:open).with("test.txt", @mode, 0664).yields(mock("status", :code => "bad status", :message => "bad status"), :file_handle)
session = mock("session", :sftp => sftp, :xserver => server("capistrano")) session = mock("session", :sftp => sftp, :xserver => server("capistrano"))
upload = Capistrano::Upload.new([session], "test.txt", :data => "data", :logger => stub_everything) upload = Capistrano::Upload.new([session], "test.txt", :data => "data", :logger => stub_everything)
assert_raises(Capistrano::UploadError) { upload.process! } assert_raises(Capistrano::UploadError) { upload.process! }
@ -43,7 +43,7 @@ class UploadTest < Test::Unit::TestCase
def test_process_when_sftp_write_fails_should_raise_error def test_process_when_sftp_write_fails_should_raise_error
sftp = mock_sftp sftp = mock_sftp
sftp.expects(:open).with("test.txt", @mode, 0660).yields(mock("status1", :code => Net::SFTP::Session::FX_OK), :file_handle) sftp.expects(:open).with("test.txt", @mode, 0664).yields(mock("status1", :code => Net::SFTP::Session::FX_OK), :file_handle)
sftp.expects(:write).with(:file_handle, "data").yields(mock("status2", :code => "bad status", :message => "bad status")) sftp.expects(:write).with(:file_handle, "data").yields(mock("status2", :code => "bad status", :message => "bad status"))
session = mock("session", :sftp => sftp, :xserver => server("capistrano")) session = mock("session", :sftp => sftp, :xserver => server("capistrano"))
upload = Capistrano::Upload.new([session], "test.txt", :data => "data", :logger => stub_everything) upload = Capistrano::Upload.new([session], "test.txt", :data => "data", :logger => stub_everything)
@ -54,7 +54,7 @@ class UploadTest < Test::Unit::TestCase
def test_upload_error_should_include_accessor_with_host_array def test_upload_error_should_include_accessor_with_host_array
sftp = mock_sftp sftp = mock_sftp
sftp.expects(:open).with("test.txt", @mode, 0660).yields(mock("status1", :code => Net::SFTP::Session::FX_OK), :file_handle) sftp.expects(:open).with("test.txt", @mode, 0664).yields(mock("status1", :code => Net::SFTP::Session::FX_OK), :file_handle)
sftp.expects(:write).with(:file_handle, "data").yields(mock("status2", :code => "bad status", :message => "bad status")) sftp.expects(:write).with(:file_handle, "data").yields(mock("status2", :code => "bad status", :message => "bad status"))
session = mock("session", :sftp => sftp, :xserver => server("capistrano")) session = mock("session", :sftp => sftp, :xserver => server("capistrano"))
upload = Capistrano::Upload.new([session], "test.txt", :data => "data", :logger => stub_everything) upload = Capistrano::Upload.new([session], "test.txt", :data => "data", :logger => stub_everything)
@ -70,7 +70,7 @@ class UploadTest < Test::Unit::TestCase
def test_process_when_sftp_succeeds_should_raise_nothing def test_process_when_sftp_succeeds_should_raise_nothing
sftp = mock_sftp sftp = mock_sftp
sftp.expects(:open).with("test.txt", @mode, 0660).yields(mock("status1", :code => Net::SFTP::Session::FX_OK), :file_handle) sftp.expects(:open).with("test.txt", @mode, 0664).yields(mock("status1", :code => Net::SFTP::Session::FX_OK), :file_handle)
sftp.expects(:write).with(:file_handle, "data").yields(mock("status2", :code => Net::SFTP::Session::FX_OK)) sftp.expects(:write).with(:file_handle, "data").yields(mock("status2", :code => Net::SFTP::Session::FX_OK))
sftp.expects(:close_handle).with(:file_handle).yields sftp.expects(:close_handle).with(:file_handle).yields
session = mock("session", :sftp => sftp, :xserver => server("capistrano")) session = mock("session", :sftp => sftp, :xserver => server("capistrano"))