我正在开发基于 rails4 和 rspec 测试框架的可安装引擎。我通过'rg scaffold post title content'构建了一个简单的应用程序。除了视图测试,一切都很好。当我执行 rake app:spec:views 时,它总是说:
" 失败/错误:渲染 ActionView::MissingTemplate: Missing template posts/indexwith {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, : png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[ :erb, :builder, :raw, :ruby]}。在以下位置搜索:* "/projects/_plugins/blorgh4m_rspect/spec/dummy/app/views" * "/projects/_plugins/blorgh4m_rspect/app/views" "
所以我将“渲染”更改为“渲染模板:“blorgh4m_rspect/posts/show”,错误变为
" Failure/Error: render template: "blorgh4m_rspect/posts/index" ActionView::Template::Error: undefined method
post_path' for #<#<Class:0x0000000427cb40>:0x00000004ff97f0> # ./app/views/blorgh4m_rspect/posts/index.html.erb:21:in
block in home_elbbub _works_projects__plugins_blorgh_m_rspect_app_views_blorgh_m_rspect_posts_index_html_erb__569958834415291959_42058840' # ./app/views/blorgh4m_rspect/posts/index.html.erb:15:ineach' # ./app/views/blorgh4m_rspect/posts/index.html.erb:15:in
home_elbbub _works_projects__plugins_blorgh_m_rspect_app_views_blorgh_m_rspect_posts_index_html_erb__569958834415291959_42058840' # ./spec/views/blorgh4m_rspect/posts/index.html.erb_spec.rb:20:in 'block (2 levels) in ' "
看起来所有路由路径助手都无效。
有人遇到过这种情况吗?你有什么想法吗?