黄瓜测试文件下载 [英] cucumber test file download
本文介绍了黄瓜测试文件下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都有想法如何使用黄瓜测试文件下载?
Anybody have idea how to test file download using cucumber?
推荐答案
这适用于我使用send_data像 send_data(data,:filename =>inventory _#{Date.today.to_s} .csv,:disposition =>'attach')
This worked for me based when using send_data like so send_data(data, :filename => "inventory_#{Date.today.to_s}.csv", :disposition => 'attachment')
可能不是写步骤的最好方法,但它工作了!
Probably not best way to write the step, but it worked!
Then /^I should receive a file(?: "([^"]*)")?/ do |file|
result = page.response_headers['Content-Type'].should == "application/octet-stream"
if result
result = page.response_headers['Content-Disposition'].should =~ /#{file}/
end
result
end
这篇关于黄瓜测试文件下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文