我定义了一个在wsp_controller称为定位功能:的Rails 3 - 渲染布局腐化测试
def location
@title ="Edit account"
@page_name = "edit"
end
,它工作正常。但是当我尝试渲染这样的布局时:
def location
@title ="Edit account"
@page_name = "edit"
render :layout => 'signup_login'
end
RSpec测试开始失败。然而,该应用程序做了什么,但测试失败。 我有布局的JavaScript代码,当我去/位置时,如果我把JavaScript的应用程序布局,它的工作原理(测试和应用程序),但是没有必要把它放在那里,所以我想一个新的布局并渲染它。
我该怎么做?
编辑:下面是我在routes.rb中
match '/wsps/:id/location', :to =>'wsps#location'
感谢。
编辑:
RSpec的错误的部分:
Failures:
1) WspsController GET 'index' for non-signed-in wsps should deny access to 'index'
Failure/Error: get :index
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.errors
它简单不,当我呈现布局通过测试。但只有这种方法。
失败消息在您的Rspec测试上说了些什么? – jergason 2010-11-27 02:09:24