« Return to Thread: Attachment-fu + Story Runner
On Dec 11, 2007 6:18 AM, Daniel Tenner <daniel.ruby@...> wrote:Hi all,I'm trying to run a Story Runner integration test that uploads a filethrough Attachment-fu.I've tried various ways of specifying the file data, from custom mocks:class MockFile < Struct.new(:original_filename, :read, :content_type); endfdata = MockFile.new "test_upload.txt", "Test Upload", "text/plain"to 'proper' railsy stubs like:fdata = ActionController::TestUploadedFile.new("../spec/fixtures/test_upload.txt", "text/plain")The actual params are specified as:{ :uploaded_data => fdata,:filename => file_reference_name(identifier)}Now, this is being passed successfully into attachment-fu, where itis processed. Well, almost successfully. Somehow, along the way, theTestUploadedFile, struct, mock, whatever you want, gets turned into aString. Then it blows up when attachment-fu tries to retrieve thecontent type:#<NoMethodError: undefined method `content_type' for"#<ActionController::TestUploadedFile:0x34349ac>":String>Somehow, I can't seem to pass anything but a String down into thecontroller. Even in the action, the TestUploadedFile is alreadytransmogrified into a String (which, of course, has no content_typeproperty). I put a logging statement in the ActionController too, andit seems that the entire params hash is turned into a stringsomewhere in there - which would explain why the object has literallyno chance of going through.I'm a bit stumped by this. I guess it makes sense that params areturned into strings - but then what sort of string should i specifyfor a file upload?Thanks for any help.Code please._______________________________________________rspec-users mailing list
« Return to Thread: Attachment-fu + Story Runner
| Free embeddable forum powered by Nabble | Forum Help |