1

Recently, my sections of capybara that attached files, failed to operate.

attach_file('file_upload', 'testfiles/test.doc')

Previously, my file paths were not absolute, and that was fine. Then I started receiving a rejection;

unknown error: path is not absolute: testfiles/test.doc

If I made my path absolute;

attach_file('file_upload', '/tmp/test.doc')

It would not complain, but fail to attach the file as well.

Has anyone had this issue? Any ideas on how to fix it?

4

1 回答 1

2

所以理论上是一些gem版本冲突导致了绝对路径要求。

该文件在网络应用程序上失去了可见性,但已附加并上传。

一个很好的解决方法是使用 absolute_path 进行本地到 CI 迁移。

attach_file('file_upload', File.absolute_path('testfiles/test.doc'))
于 2013-11-05T16:49:40.180 回答