我正在使用s3_direct_upload将视频直接上传到S3。用户访问该页面,单击div作为单击表单输入的代理,选择文件,点击“确定”,然后在视频上传时完成表单。我想用水豚来测试一下,但看起来我需要诉诸#attach_file
。这是我唯一的选择吗?
答案 0 :(得分:1)
在水豚规范中,我最终采用了不太理想的方法:
find(:css, '#choose-file').click
我的HAML所在的地方:
.choose-files
= s3_uploader_form callback_url: videos_url,
callback_param: 'video[direct_upload_url]',
id: 's3-uploader',
expiration: 24.hours.from_now.utc.iso8601,
max_file_size: 100.megabytes,
acl: 'public-read' do
.small.button#choose-file{data: {upload: 'button'}} Choose File
.hide
= file_field_tag :file, multiple: true, id: 'upload-input'
- content_for :javascript do
:coffee
$ ->
$('#s3-uploader').S3Uploader
remove_completed_progress_bar: false
progress_bar_target: $('#uploads_container')