0
我正在使用灯具,我正在运行测试,需要从某个人访问某个文件的URL。我不想每次都通过互联网去获取这个文件,所以我已经下载了这个文件并把它放在我的测试目录"/test/sample/somefile.html"
中。Rails引用本地路径的灯具
如何在夹具文件中写入本地路径,以便在我的测试中访问file_path
。
#BEFORE
three:
id: 3
user: Joey
file_path: http://www.google.com/somefile.html
last_modified:
#AFTER
three:
id: 3
user: Joey
file_path: <%= "./test/sample/somefile.html" %>
last_modified:
我正在访问该文件,但我可以让它看起来像一个URL而不是我的测试中的文件路径? – alenm
我看不到如何。备用解决方案:将文件放在公用文件夹中,然后您就可以使用它的网址。 – apneadiving