Testing picture / file uploads with webrat and cucumber

Send to friend

Webrat implements the step:

1
2
3
4
5

When /^I attach the "(.*)" file at "(.*)" to "(.*)"$/ do |type, path, field|
  attach_file(field, path, type)
end

So, for example:

1
2
3
4
5

Given X
When I attach the "image/jpg" file at "features/support/picture.jpg" to "avatar_image"
Then Y