spec/ftp_spec.rb in carrierwave-ftp-0.1.1 vs spec/ftp_spec.rb in carrierwave-ftp-0.1.2
- old
+ new
@@ -12,10 +12,11 @@
config.ftp_host = 'ftp.testcarrierwave.dev'
config.ftp_user = 'test_user'
config.ftp_passwd = 'test_passwd'
config.ftp_folder = '~/public_html'
config.ftp_url = 'http://testcarrierwave.dev'
+ config.ftp_passive = true
end
@file = CarrierWave::SanitizedFile.new(file_path('test.jpg'))
FtpUploader.stub!(:store_path).and_return('uploads/test.jpg')
@storage = CarrierWave::Storage::FTP.new(FtpUploader)
@@ -29,10 +30,11 @@
'test_passwd',
21
]
Net::FTP.should_receive(:open).with(*ftp_params).and_return(ftp)
+ ftp.should_receive(:passive=).with(true)
ftp.should_receive(:mkdir_p).with('~/public_html/uploads')
ftp.should_receive(:chdir).with('~/public_html/uploads')
ftp.should_receive(:put).with(@file.path, 'test.jpg')
ftp.should_receive(:close)
@stored = @storage.store!(@file)
@@ -40,10 +42,11 @@
describe 'after upload' do
before do
ftp = double(:ftp_connection)
Net::FTP.stub(:open).and_return(ftp)
+ ftp.stub(:passive=)
ftp.stub(:mkdir_p)
ftp.stub(:chdir)
ftp.stub(:put)
ftp.stub(:close)
@stored = @storage.store!(@file)
@@ -60,9 +63,10 @@
describe 'other operations' do
before do
@ftp = double(:ftp_connection)
Net::FTP.stub(:open).and_return(@ftp)
+ @ftp.stub(:passive=)
@ftp.stub(:mkdir_p)
@ftp.stub(:chdir)
@ftp.stub(:put)
@ftp.stub(:close)
@stored = @storage.store!(@file)