diff test/functional/users_controller_test.rb @ 23:ca82a3468d27 cannam

* Merge SVN update from default
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 24 Sep 2010 14:17:42 +0100
parents 40f7cfd4df19
children 94944d00e43c
line wrap: on
line diff
--- a/test/functional/users_controller_test.rb	Thu Sep 23 16:19:06 2010 +0100
+++ b/test/functional/users_controller_test.rb	Fri Sep 24 14:17:42 2010 +0100
@@ -143,6 +143,18 @@
     assert_equal [u.mail], mail.bcc
     assert mail.body.include?('newpass')
   end
+
+  test "POST :edit with a password change to an AuthSource user switching to Internal authentication" do
+    # Configure as auth source
+    u = User.find(2)
+    u.auth_source = AuthSource.find(1)
+    u.save!
+
+    post :edit, :id => u.id, :user => {:auth_source_id => ''}, :password => 'newpass', :password_confirmation => 'newpass'
+
+    assert_equal nil, u.reload.auth_source
+    assert_equal User.hash_password('newpass'), u.reload.hashed_password
+  end
   
   def test_edit_membership
     post :edit_membership, :id => 2, :membership_id => 1,