我的create
控制器中有users
个动作:
def create
@user= User.new(user_params)
if @user.save
#success action filled
else
render 'new'
end
end
和测试以检查错误无效用户的模板是否通知:
test "user input error" do
get signup_path
assert_no_difference 'User.count' do
post users_path,user:{name:"raj",email:"sad",password:"sad",password_confirmation:"sad"}
end
assert_template 'new'
end
正在过世。但是当我将render new
更改为render new.html.erb
时,它会失败。
expecting <"users/new.html.erb"> but rendering with <["shared/_error_messages", "users/new", "layouts/_shim", "layouts/_header.html.erb", "layouts/_footer.html.erb", "layouts/application"]>
这些是页面中的其他布局。有人可以解释为什么会这样吗?