Sha256: 4fceeebe70a0c62031c60abb72371552fb93e9c658287776f79febf995cd59a6

Contents?: true

Size: 653 Bytes

Versions: 17

Compression:

Stored size: 653 Bytes

Contents

module TemporaryDirectory
  def self.included(mod)
    mod.before{init_temporary_directory}
    mod.after{remove_temporary_directory}
  end

  def temporary_directory
    "#{ROOT}/spec/tmp"
  end

  private  # ---------------------------------------------------------

  def init_temporary_directory
    remove_temporary_directory
    FileUtils.mkdir_p(temporary_directory)

    # When an attachment is deleted, it deletes empty ancestral
    # directories.  Don't delete past the temporary directory.
    FileUtils.touch "#{temporary_directory}/.do_not_delete"
  end

  def remove_temporary_directory
    FileUtils.rm_rf(temporary_directory)
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bulldog-0.1.1 spec/helpers/temporary_directory.rb
bulldog-0.1.0 spec/helpers/temporary_directory.rb
bulldog-0.0.15 spec/helpers/temporary_directory.rb
bulldog-0.0.14 spec/helpers/temporary_directory.rb
bulldog-0.0.13 spec/helpers/temporary_directory.rb
bulldog-0.0.12 spec/helpers/temporary_directory.rb
bulldog-0.0.11 spec/helpers/temporary_directory.rb
bulldog-0.0.10 spec/helpers/temporary_directory.rb
bulldog-0.0.9 spec/helpers/temporary_directory.rb
bulldog-0.0.8 spec/helpers/temporary_directory.rb
bulldog-0.0.7 spec/helpers/temporary_directory.rb
bulldog-0.0.6 spec/helpers/temporary_directory.rb
bulldog-0.0.5 spec/helpers/temporary_directory.rb
bulldog-0.0.3 spec/helpers/temporary_directory.rb
bulldog-0.0.4 spec/helpers/temporary_directory.rb
bulldog-0.0.2 spec/helpers/temporary_directory.rb
bulldog-0.0.1 spec/helpers/temporary_directory.rb