From 64af957031ff1f0e4fa04e4cc55c29f87124a230 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 25 Mar 2020 03:05:27 -0500 Subject: [PATCH] tests: remove old password change tests. Followup to 5faa32372. Equivalent tests exist in tests/functional/passwords_controller_test.rb --- test/unit/user_test.rb | 50 ------------------------------------------ 1 file changed, 50 deletions(-) diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index fd62fba11..6aa81b3a5 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -151,56 +151,6 @@ class UserTest < ActiveSupport::TestCase end context "password" do - should "match the confirmation" do - @user = FactoryBot.create(:user) - @user.old_password = "password" - @user.password = "zugzug5" - @user.password_confirmation = "zugzug5" - @user.save - @user.reload - assert(User.authenticate(@user.name, "zugzug5"), "Authentication should have succeeded") - end - - should "fail if the confirmation does not match" do - @user = FactoryBot.create(:user) - @user.password = "zugzug6" - @user.password_confirmation = "zugzug5" - @user.save - assert_equal(["Password confirmation doesn't match Password"], @user.errors.full_messages) - end - - should "not be too short" do - @user = FactoryBot.create(:user) - @user.password = "x5" - @user.password_confirmation = "x5" - @user.save - assert_equal(["Password is too short (minimum is 5 characters)"], @user.errors.full_messages) - end - - should "not change the password if the password and old password are blank" do - @user = FactoryBot.create(:user, :password => "67890") - @user.update(password: "", old_password: "") - assert(@user.bcrypt_password == User.sha1("67890")) - end - - should "not change the password if the old password is incorrect" do - @user = FactoryBot.create(:user, :password => "67890") - @user.update(password: "12345", old_password: "abcdefg") - assert(@user.bcrypt_password == User.sha1("67890")) - end - - should "not change the password if the old password is blank" do - @user = FactoryBot.create(:user, :password => "67890") - @user.update(password: "12345", old_password: "") - assert(@user.bcrypt_password == User.sha1("67890")) - end - - should "change the password if the old password is correct" do - @user = FactoryBot.create(:user, :password => "67890") - @user.update(password: "12345", old_password: "67890") - assert(@user.bcrypt_password == User.sha1("12345")) - end - context "in the json representation" do setup do @user = FactoryBot.create(:user)