3 Responses to “Testing file uploads to attachment_fu using RSpec”

  1. Sonny Says:

    Hi ant,

    Thanks for the article. I’ve got a problem running your code, perhaps you could shed lights here.

    My autotest returned the following error when it got to the line Image.create

    Mock ‘Image_1012’ received unexpected message :save with (no args)

    You have any ideas why?

    Regards,

    Sonny

  2. jan Says:

    Oh I didn’t know about the fixture_file_upload method, thanks!

    Btw you can mock the actual save of the file and that will solve both of the problems you have:

    Image.any_instance.expects(:save_to_storage).returns(true)
  3. Bellani Says:

    You could also change the before and after to before(:all) and after(:all). It would reduce the overhead.

Leave a Reply ☆

Blog uses Mephisto
Design from OSWD
by dreamLogic