我定義了一個在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