大佬教程收集整理的这篇文章主要介绍了ruby-on-rails – 使用Rspec测试的Rails —> ActionView :: MissingTemplate:,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是spec / controllers / movies_controller_spec.rb中的测试代码段
describe MoviesController do describe 'update' do it 'should call the model method to look up the movie to update' do Movie.should_receive(:find).with("3") put :update,{:id => "3"} end end
这是controllers / movies_controller.rb中的控制器方法:
def update Movie.find(params[:id]) end
我遇到了这个问题:
1) MoviesController update should call the model method to look up the movie to update Failure/Error: post :update,{:id => "3"} ActionView::MissingTemplate: Missing template movies/update,application/update with {:handlers=>[:erb,:builder,:coffee,:haml],:formats=>[:html],:locale=>[:en,:en]}. Searched in: * "#<RSpec::rails::ViewRendering::EmptyTemplatePathSetDecorator:0xa65b300>" # ./spec/controllers/movies_controller_spec.rb:8:in `block (3 levels) in <top (required)>'
我的路线看起来像:
@H_51_4@movies GET /movies(.:format) {:action=>"index",:controller=>"movies"} POST /movies(.:format) {:action=>"create",:controller=>"movies"} new_movie GET /movies/new(.:format) {:action=>"new",:controller=>"movies"} edit_movie GET /movies/:id/edit(.:format) {:action=>"edit",:controller=>"movies"} movie GET /movies/:id(.:format) {:action=>"show",:controller=>"movies"} PUT /movies/:id(.:format) {:action=>"update",:controller=>"movies"} deletE /movies/:id(.:format) {:action=>"destroy",:controller=>"movies"}谁能帮助我,告诉我在这么简单的例子中我到底做错了什么?
以上是大佬教程为你收集整理的ruby-on-rails – 使用Rspec测试的Rails —> ActionView :: MissingTemplate:全部内容,希望文章能够帮你解决ruby-on-rails – 使用Rspec测试的Rails —> ActionView :: MissingTemplate:所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。