Update test to test exactly what we want to test

Since this test was added in commit 78c6a30424 the
"current_password" was filled with an incorrect value.

This test did not fail because in previous versions of the
"devise-security" gem if this "current_password" was not valid
a "self.valid?" was performed which caused the error we are testing.

In version 0.17 (as can be seen in the following commit
https://github.com/devise-security/devise-security/pull/340/commits/41a99b67fe0)
if the "current_password" is not valid, related errors are still added
 but the "self.valid?" code is removed, which is what causes the
expected error "must be different than the current password"
to appear in the "new password" field.

By adding a correct "current_password" in the test, we avoid this validation
for the "current_password" (which no longer includes the expected error)
and follow the natural flow of devise that does end up intercepting the error
for the new password entered.
This commit is contained in:
taitus
2023-03-27 13:17:27 +02:00
committed by Javi Martín
parent 33f5f4cdb9
commit 79d65305b0

View File

@@ -737,7 +737,7 @@ describe "Users" do
expect(page).to have_content "Your password is expired"
fill_in "Current password", with: "judgmentday"
fill_in "Current password", with: "123456789"
fill_in "New password", with: "123456789"
fill_in "Password confirmation", with: "123456789"
click_button "Change your password"