@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_create :files_to_final_location
- after_destroy :delete_from_disk
+ after_commit :delete_from_disk, :on => :destroy
# Returns an unsaved copy of the attachment
def copy(attributes=nil)
# Do not include all helpers
config.action_controller.include_all_helpers = false
+ # Do not supress errors in after_rollback and after_commit callbacks
+ config.active_record.raise_in_transactional_callbacks = true
+
# XML parameter parser removed from core in Rails 4.0
# and extracted to actionpack-xml_parser gem
config.middleware.insert_after ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser
fixtures :users, :projects, :roles, :members, :member_roles,
:enabled_modules, :issues, :trackers, :attachments
+ # TODO: remove this with Rails 5 that supports after_commit callbacks
+ # in transactional fixtures (https://github.com/rails/rails/pull/18458)
+ self.use_transactional_fixtures = false
+
class MockFile
attr_reader :original_filename, :content_type, :content, :size