如何编写用于编辑用户信息function和更改密码function的rspec测试?

有谁知道如何为这两个函数编写rspec测试? 更新function用于允许用户编辑其信息并进行更新。 第二个function用于通过要求用户的旧密码更改用户的密码。

def update @user = current_user if @user.update_attributes(user_params) head :no_content else render_error(:unprocessable_entity, "Failed to update information") end end def change_password @user = current_user if @user.authenticate(params[:password]) @user.update_attributes({:password => params[:password]}) head :no_content else render_error(:unprocessable_entity, "Wrong Password!") end end