spec/ftp_spec.rb in carrierwave-ftp-0.2.6 vs spec/ftp_spec.rb in carrierwave-ftp-0.2.7

- old
+ new

@@ -29,11 +29,13 @@ 'test_user', 'test_passwd', 21 ] - Net::FTP.should_receive(:open).with(*ftp_params).and_return(ftp) + Net::FTP.should_receive(:new).and_return(ftp) + ftp.should_receive(:connect).with('ftp.testcarrierwave.dev', 21) + ftp.should_receive(:login).with('test_user', 'test_passwd') 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) @@ -41,11 +43,13 @@ end describe 'after upload' do before do ftp = double(:ftp_connection) - Net::FTP.stub(:open).and_return(ftp) + Net::FTP.stub(:new).and_return(ftp) + ftp.stub(:connect) + ftp.stub(:login) ftp.stub(:passive=) ftp.stub(:mkdir_p) ftp.stub(:chdir) ftp.stub(:put) ftp.stub(:close) @@ -62,10 +66,12 @@ end describe 'other operations' do before do @ftp = double(:ftp_connection) - Net::FTP.stub(:open).and_return(@ftp) + Net::FTP.stub(:new).and_return(@ftp) + @ftp.stub(:connect) + @ftp.stub(:login) @ftp.stub(:passive=) @ftp.stub(:mkdir_p) @ftp.stub(:chdir) @ftp.stub(:put) @ftp.stub(:close)