«
»

Rails, Software

Using Cucumber to test Paperclip file attachments

08.31.09 | Comment?

I was using thoughtbot’s paperclip to attach files. I realised that paperclip only provide shoulda macros for test::unit. No cucumber macros? In the end, I got to write it. Its very simple.

The feature is shown here:

Define your steps:

As celerity does not have an attach_file method, I got to write my own. You could see it’s not hard at all. Remember to define the browser variable.

Last, we have some hooks to clean up the test upload files. Remember to place an @upload tag in your scenario.

Tags: , , ,

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

:

:


«
»