24
Jun
09

Testing Attachment fu

Quick post de como hacer el testing a attachment fu:

1.- Hacemos una carpeta dentro de fixtures que se llame files:
mkdir test/fixtures/files

2.- …incluimos algun archivo doc, imagen lo que sea.

3.- Dentro del test hacemos el load de esta forma

test "should create person" do
fdata = fixture_file_upload(‘/files/doctestfile.doc’, ‘application/msword’)
assert_difference(‘Person.count’) do
post :create, :resume => {
:person_id => 1,
:uploaded_document => fdata
},:html => { :multipart => true }
end
end

y ya… creo que ya


0 Respuestas a “Testing Attachment fu”



  1. Aún no hay comentarios

Escribe un comentario