Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
Handle nil password case
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehodgkiss committed Sep 28, 2012
1 parent a16cc7c commit adc3310
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/zxcvbn/password_strength.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def initialize
end

def test(password, user_inputs = [])
password = password || ''
result = nil
calc_time = Benchmark.realtime do
matches = @omnimatch.matches(password, user_inputs)
Expand Down
6 changes: 6 additions & 0 deletions spec/zxcvbn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@
result.score.should eq 0
end
end

context 'nil password' do
specify do
expect { zxcvbn(nil) }.to_not raise_error
end
end
end

0 comments on commit adc3310

Please sign in to comment.