【发布时间】:2020-05-20 14:15:32
【问题描述】:
使用: 红宝石 2.4.0p0 导轨 5.2.3 在运行我的测试用例时: 有和错误:
我的测试用例是这样的:
require 'test_helper'
class SubscriptionsControllerTest < ActionDispatch::IntegrationTest
test "Can reach to index " do
get subscriptions_url
assert_response :success
end
结束
错误:
SubscriptionsControllerTest#test_Can_reach_to_index_:
ActionView::Template::Error: Can't resolve image into URL: undefined method `[]' for nil:NilClass
app/views/subscriptions/index.html.erb:43:in `_app_views_subscriptions_index_html_erb__900758959545617488_70234463713200'
test/controllers/subscriptions_controller_test.rb:6:in `block in <class:SubscriptionsControllerTest>'
但手动打开 ui 时图像加载正确。你能建议什么是错的。 在视图中有 image_tag 在第 43 行。
<%= image_tag 'tukacad_1.png', alt: '', class: "img-responsive" %>
【问题讨论】:
标签: html ruby-on-rails-3 ruby-on-rails-5 ruby-2.4