Sha256: c48ce6da99fa8f6da5f9cc98c24e525d4a249556b923c4518d8340956458d531

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

require "spec_helper"

describe "Integration", :integration => true do
  before do
    require "support/integration/ftp_server"
    require "support/integration/user"
    FtpServer.clear
    FtpServer.start
  end

  let(:file) { File.new(File.expand_path("../support/integration/avatar.jpg", __FILE__), "rb") }

  it "stores the attachment on the ftp servers" do
    user = User.new
    user.avatar = file
    user.save!
    file.close

    File.exists?(FtpServer::HOME_PATH + "/#{user.id}/original/avatar.jpg").should be_true
  end

  it "deletes an attachment from the ftp servers" do
    user = User.new
    user.avatar = file
    user.save!
    file.close

    user.destroy

    File.exists?(FtpServer::HOME_PATH + "/#{user.id}/original/avatar.jpg").should be_false
  end

  it "survives temporarily closed ftp connections" do
    user = User.new
    user.avatar = file
    user.save!

    user.avatar = nil
    user.save!

    FtpServer.restart

    user.avatar = file
    user.save!
    file.close

    File.exists?(FtpServer::HOME_PATH + "/#{user.id}/original/avatar.jpg").should be_true
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
paperclip-storage-ftp-1.0.4 spec/integration_spec.rb
paperclip-storage-ftp-1.0.3 spec/integration_spec.rb
paperclip-storage-ftp-1.0.2 spec/integration_spec.rb
paperclip-storage-ftp-1.0.1 spec/integration_spec.rb