Sha256: 3c319158279f1bc81c188d6127f95b46a662a17dc44a95f9b1b851ce0600ab7a

Contents?: true

Size: 746 Bytes

Versions: 22

Compression:

Stored size: 746 Bytes

Contents

require 'spec_helper'

describe "Saving an attachment" do
  use_model_class(:Thing, :value => :integer)

  #
  # The list of files this process has open.
  #
  def open_files
    `lsof -p #{Process.pid} -F n`.split(/\n/).sort
  end

  it "should not leave any file handles left open" do
    tmp = temporary_directory
    Thing.has_attachment :photo do
      path "#{tmp}/:style.png"
      style :small, :size => '10x10'
      process :after => :save do
        resize
      end
    end

    path = create_image("#{temporary_directory}/tmp.jpg")
    open(path) do |file|
      @initial_open_files = open_files
      thing = Thing.new(:photo => file)
      thing.save.should be_true
      open_files.should == @initial_open_files
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
bulldog-0.2.4 spec/integration/saving_an_attachment_spec.rb
bulldog-0.2.3 spec/integration/saving_an_attachment_spec.rb
bulldog-0.2.2 spec/integration/saving_an_attachment_spec.rb
bulldog-0.2.1 spec/integration/saving_an_attachment_spec.rb
bulldog-0.2.0 spec/integration/saving_an_attachment_spec.rb
bulldog-0.1.1 spec/integration/saving_an_attachment_spec.rb
bulldog-0.1.0 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.15 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.14 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.13 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.12 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.11 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.10 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.9 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.8 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.7 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.6 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.5 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.3 spec/integration/saving_an_attachment_spec.rb
bulldog-0.0.4 spec/integration/saving_an_attachment_spec.rb