0
我有一個軌道4的應用程序,需要與避免HTTP 500如果在鐵軌
http_basic_authenticate_with name: "ILoveSO", password: "ItrustSOwithmypassword"
然而,當我嘗試測試認證失敗引發錯誤500驗證不提供身份驗證(無HTTP認證頭中提供)。
NoMethodError: undefined method
user' for nil:NilClass app/controllers/application_controller.rb:5:in
' app/controllers/application_controller.rb:1:in `'
如何發送HTTP 403而不是在未定義的密鑰上失敗?
這是我用我的單元測試代碼:
assert_response :error, get("ping")
編輯:當我試圖調試這一點,我發現,如果我尖叫了我唯一的測試文件:
test "nothing" do
end
我仍然收到錯誤。
WTF正在發生?