Dee*_*ane 5 testing ruby-on-rails cucumber uploadify
我想在rails 3上的ruby上进行黄瓜测试.我试图点击capybara的上传按钮,但因为它既不是按钮也不是链接.此外,它隐藏了text_field,所以我不能写"当我填写"上传"with"text.txt"".如果有人解决了这个问题,请在此处提供帮助.
编写上传文件的自定义步骤
When /^(?:|I)attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
type = path.split(".")[1]
case type
when "jpg"
type = "image/jpg"
when "png"
type = "image/png"
when "gif"
type = "image/gif"
end
attach_file(field, path, type)
end
When /^I attach the "(.*)" file at "(.*)" to "(.*)"$/ do |type, path, field|
attach_file(field,path,type)
end
Run Code Online (Sandbox Code Playgroud)
黄瓜步像
当我将文件“/images/back.gif”附加到“data_input”时
| 归档时间: |
|
| 查看次数: |
600 次 |
| 最近记录: |