Skip to content

Commit

Permalink
Revert "Fixes a bug when generating a password with min_length eq 1 (f…
Browse files Browse the repository at this point in the history
…aker-ruby#2138)"

This reverts commit 47bc44e.
  • Loading branch information
droznyk committed Oct 23, 2020
1 parent 7588f1d commit 17d9b32
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
2 changes: 1 addition & 1 deletion lib/faker/default/internet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def password(legacy_min_length = NOT_GIVEN, legacy_max_length = NOT_GIVEN, legac
keywords << :special_characters if legacy_special_characters != NOT_GIVEN
end

min_alpha = mix_case && min_length > 1 ? 2 : 0
min_alpha = mix_case ? 2 : 0
temp = Lorem.characters(number: min_length, min_alpha: min_alpha)
diff_length = max_length - min_length

Expand Down
14 changes: 0 additions & 14 deletions test/faker/default/test_faker_internet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,6 @@ def test_password_with_mixed_case
assert downcase_count >= 1
end

def test_password_with_min_length_eq_1
min_length = 1
password = @tester.password(min_length: min_length)
assert password.match(/\w+/)
end

def test_password_with_min_length_and_max_length
min_length = 2
max_length = 5
password = @tester.password(min_length: min_length, max_length: max_length)
assert password.match(/\w+/)
assert (min_length..max_length).include?(password.size), 'Password size is incorrect'
end

def test_password_without_mixed_case
assert @tester.password(min_length: 8, max_length: 12, mix_case: false).match(/[^A-Z]+/)
end
Expand Down

0 comments on commit 17d9b32

Please sign in to comment.