[RoR ] Functional test 有問題
目前需為已存在的 Ruby on Rails code 寫 Testing
但在寫某個 test_update 時卻碰上了問題
原程式將 update 的 validate 寫在 controller 中
節錄一小段
if params[:user][:clear_password] and
params[:user][:clear_password].length > 0 and
params[:user][:confirm_password] != params[:user][:clear_password]
flash[:error] = 'Password invalid!'
render :action => 'edit'
當我測試密碼兩者輸入不同時
卻會在執行到 render 的地方跳出 exception
Exception: You have a nil object when you didn't expect it!
The error occured while evaluating nil.site_name
On line #43 of app/views/layouts/application.rhtml
40: <body>
41: <div class="header">
42: <img src="/images/logo.jpg"/>
43: <h1><%= @settings.site_name %></h1>
44: <h2><%= @settings.site_subtitle %></h2>
45: </div>
46: <div class="navbar">
可以請高手幫忙看看是什麼問題嗎?
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 65.190.196.191
推
12/03 15:33, , 1F
12/03 15:33, 1F
→
12/03 21:05, , 2F
12/03 21:05, 2F
→
12/03 21:06, , 3F
12/03 21:06, 3F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 3 篇):