Rspec2缺少模板错误

时间:2011-07-14 18:25:37

标签: ruby-on-rails ruby testing rspec rspec2

升级后的表格Rails 2到3.并且RSpec 1到2.看起来像capybara / webrat试图找到模板时我只希望它找到动作。什么是可能的解决方法?

错误

Failure/Error: delete :read, :id => @feed_entry.id, :format => 'json'
Missing template feed_entries/read with {:handlers=>[:erb, :rjs, :rhtml, :rxml, :builder], :formats=>[:json], :locale=>[:en, :en]} in view paths "/Users/maletor/Sites/3md/app/views", ...
# ./app/controllers/feed_entries_controller.rb:37:in `read'
# ./app/controllers/feed_entries_controller.rb:35:in `read'
# ./spec/controllers/feed_entries_controller_spec.rb:200

应用程序/控制器/ feed_entries_controller#读

def read
  if request.post?    
    @feed_entry.read_by(current_account)
  elsif request.delete? 
    @feed_entry.unread_by(current_account)
  end    

  respond_to do |format|
    format.html  { redirect_to topic_path(params[:topic_id]) }
    format.json  { render :nothing => :true, :status => :no_content }
    format.plist { render :nothing => :true, :status => :no_content }
  end
end

规格/控制器/ feed_entries_controller_spec.rb:200

delete :read, :id => @feed_entry.id, :format => 'json'

1 个答案:

答案 0 :(得分:2)

您似乎无法render :nothing => true状态与200不同。另一种方法是使用render,而是使用head :no_content