RailsCasts Pro episodes are now free!

Learn more or hide this

Xavier Lozinguez's Profile

GitHub User: xlprojects

Site: www.xlprojects.com

Comments by Xavier Lozinguez

Avatar

Hey everyone,

I've implemented a way to change the password (not reset the password) see here.

However I have trouble hooking up rspec tests for this bit of code... If anyone can help me out...

Avatar

Here is how:

ruby
def update_password(current_password, new_password, new_password_confirmation)
  if new_password == new_password_confirmation
    if !User.authenticate(self.username, current_password).nil?
      return self.change_password!(new_password)
    else
      return false
    end
  else
    return false
  end
end
Avatar

Same here, any luck solving the issue?