ActionView::MissingTemplate during testing
I'm testing a rails controller and attempting to perform a get with the code:
delete :remove_logs, :id => 3
And it consistently returns me an ActionView::MissingTemplate exception. I know that this is because there is no view associated with the get. There is a route for this method (from rake routes):
remove_logs /devices/remove_logs/:id(.:format) {:controller=>"devices", :action=>"remove_logs"}
The function itself works perfectly for the actually webpage as it's being called with:
<%= link_to "Remove History", remove_logs_path(device),
:class => "medium red button", :confirm => 'This will remove all history from
this device. Are you sure?', :method => :delete %>
So my question is, is there a way to bypass or trick the test to not attempt to access the view and just access the controller method? This isn开发者_开发百科't my system I'm testing so I really don't want to make a new blank view or anything similar.
I think the problem may be related with the code in controller (remove_logs action) which usually has some code about redirecting to another url like bellow:
def destroy
@tag = Tag.find(params[:id])
@tag.destroy
redirect_to :action => :index
end
I test with Test::Unit in my rails app, and it goes fine when having redirecting code.
精彩评论