A kata from Roy Osherove.
Create a password verifications class called PasswordVerifier
.
- Add the following verifications to a class function
verify
that returns true or false.- Password should be at least 8 characters.
- Password should have at least one uppercase letter.
- Password should have at least one lowercase letter.
- Password should have at least one number.
- Add feature: password is okay if at least three of the previous conditions is true.
- Add feature: password is never okay if item 1.4 is not true.
Useful command line tools:
rake
to run Rubocop and RSpec.mutant --include lib --use rspec PasswordVerifier
to run Mutant.
I've made simplifications:
- Return a boolean result from
PasswordVerifier.verify
rather than raising an exception. - No check for nil password.
- Dropped instruction about making tests faster.