# Use a temporary directory for attachment related tests
def set_tmp_attachments_directory
- Dir.mkdir "#{RAILS_ROOT}/tmp/test" unless File.directory?("#{RAILS_ROOT}/tmp/test")
- Dir.mkdir "#{RAILS_ROOT}/tmp/test/attachments" unless File.directory?("#{RAILS_ROOT}/tmp/test/attachments")
- Attachment.storage_path = "#{RAILS_ROOT}/tmp/test/attachments"
+ Dir.mkdir "#{Rails.root}/tmp/test" unless File.directory?("#{Rails.root}/tmp/test")
+ unless File.directory?("#{Rails.root}/tmp/test/attachments")
+ Dir.mkdir "#{Rails.root}/tmp/test/attachments"
+ end
+ Attachment.storage_path = "#{Rails.root}/tmp/test/attachments"
end
-
+
def with_settings(options, &block)
saved_settings = options.keys.inject({}) {|h, k| h[k] = Setting[k].dup; h}
options.each {|k, v| Setting[k] = v}