这是失败的测试代码:
test "should get index" do
get products_url
assert_response :success
end
错误信息是 ActionView::Template::Error: Assets “MyString”不存在于 Assets 管道中。
什么鬼?
最佳答案
遇到同样的问题,但找到了一个简单的解决方案。 首先,我修复了/test/fixtures/products.yml
one:
title: MyString
description: MyText
image_url: lorem.jpg
price: 9.99
two:
title: MyString
description: MyText
image_url: lorem.jpg
price: 9.99
最后,我实际上在我的 Assets /图像中添加了一张名为“lorem.jpg”的图像。我觉得这很困惑,因为他们在书中根本没有提到这一点,但希望这个小指针能让你回到正轨。
关于ruby-on-rails - Controller 测试错误消息 : "ActionView::Template::Error: The asset "MyString"is not present in the asset pipeline",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45522980/