My controller accesses the tempfile attribute of an uploaded file and passes it to another mocked component. My test code has
tempfile
@file = mock(Object)
I went around this way
upload_file = fixture_file_upload('files/stats_upload.csv', 'text/csv') upload_file.stubs(:tempfile).returns(upload_file)