zxcvbn-ruby 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -1
  3. data/README.md +1 -1
  4. data/lib/zxcvbn/clock.rb +11 -0
  5. data/lib/zxcvbn/crack_time.rb +4 -2
  6. data/lib/zxcvbn/data.rb +6 -4
  7. data/lib/zxcvbn/dictionary_ranker.rb +2 -0
  8. data/lib/zxcvbn/entropy.rb +38 -33
  9. data/lib/zxcvbn/feedback.rb +2 -0
  10. data/lib/zxcvbn/feedback_giver.rb +2 -0
  11. data/lib/zxcvbn/match.rb +2 -0
  12. data/lib/zxcvbn/matchers/date.rb +11 -8
  13. data/lib/zxcvbn/matchers/dictionary.rb +3 -1
  14. data/lib/zxcvbn/matchers/digits.rb +2 -0
  15. data/lib/zxcvbn/matchers/l33t.rb +6 -2
  16. data/lib/zxcvbn/matchers/new_l33t.rb +7 -4
  17. data/lib/zxcvbn/matchers/regex_helpers.rb +2 -0
  18. data/lib/zxcvbn/matchers/repeat.rb +3 -1
  19. data/lib/zxcvbn/matchers/sequences.rb +4 -2
  20. data/lib/zxcvbn/matchers/spatial.rb +5 -3
  21. data/lib/zxcvbn/matchers/year.rb +3 -1
  22. data/lib/zxcvbn/math.rb +3 -0
  23. data/lib/zxcvbn/omnimatch.rb +3 -1
  24. data/lib/zxcvbn/password_strength.rb +5 -3
  25. data/lib/zxcvbn/score.rb +3 -1
  26. data/lib/zxcvbn/scorer.rb +11 -7
  27. data/lib/zxcvbn/version.rb +1 -1
  28. data/lib/zxcvbn.rb +2 -0
  29. metadata +6 -102
  30. data/.github/workflows/ci.yml +0 -23
  31. data/.gitignore +0 -18
  32. data/.rspec +0 -1
  33. data/CODE_OF_CONDUCT.md +0 -130
  34. data/Gemfile +0 -10
  35. data/Guardfile +0 -26
  36. data/Rakefile +0 -22
  37. data/spec/dictionary_ranker_spec.rb +0 -12
  38. data/spec/feedback_giver_spec.rb +0 -212
  39. data/spec/matchers/date_spec.rb +0 -109
  40. data/spec/matchers/dictionary_spec.rb +0 -30
  41. data/spec/matchers/digits_spec.rb +0 -15
  42. data/spec/matchers/l33t_spec.rb +0 -87
  43. data/spec/matchers/repeat_spec.rb +0 -18
  44. data/spec/matchers/sequences_spec.rb +0 -21
  45. data/spec/matchers/spatial_spec.rb +0 -20
  46. data/spec/matchers/year_spec.rb +0 -15
  47. data/spec/omnimatch_spec.rb +0 -24
  48. data/spec/scorer_spec.rb +0 -5
  49. data/spec/scoring/crack_time_spec.rb +0 -106
  50. data/spec/scoring/entropy_spec.rb +0 -216
  51. data/spec/scoring/math_spec.rb +0 -135
  52. data/spec/spec_helper.rb +0 -54
  53. data/spec/support/js_helpers.rb +0 -34
  54. data/spec/support/js_source/adjacency_graphs.js +0 -8
  55. data/spec/support/js_source/compiled.js +0 -1188
  56. data/spec/support/js_source/frequency_lists.js +0 -10
  57. data/spec/support/js_source/init.coffee +0 -63
  58. data/spec/support/js_source/init.js +0 -95
  59. data/spec/support/js_source/matching.coffee +0 -444
  60. data/spec/support/js_source/matching.js +0 -685
  61. data/spec/support/js_source/scoring.coffee +0 -270
  62. data/spec/support/js_source/scoring.js +0 -390
  63. data/spec/support/matcher.rb +0 -35
  64. data/spec/tester_spec.rb +0 -99
  65. data/spec/zxcvbn_spec.rb +0 -24
  66. data/zxcvbn-ruby.gemspec +0 -33
metadata CHANGED
@@ -1,44 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zxcvbn-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Hodgkiss
8
8
  - Matthieu Aussaguel
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2021-01-05 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: mini_racer
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: rspec
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
+ dependencies: []
42
13
  description: Ruby port of Dropboxs zxcvbn.js
43
14
  email:
44
15
  - steve@hodgkiss.me
@@ -47,16 +18,9 @@ executables: []
47
18
  extensions: []
48
19
  extra_rdoc_files: []
49
20
  files:
50
- - ".github/workflows/ci.yml"
51
- - ".gitignore"
52
- - ".rspec"
53
21
  - CHANGELOG.md
54
- - CODE_OF_CONDUCT.md
55
- - Gemfile
56
- - Guardfile
57
22
  - LICENSE.txt
58
23
  - README.md
59
- - Rakefile
60
24
  - data/adjacency_graphs.json
61
25
  - data/frequency_lists/english.txt
62
26
  - data/frequency_lists/female_names.txt
@@ -64,6 +28,7 @@ files:
64
28
  - data/frequency_lists/passwords.txt
65
29
  - data/frequency_lists/surnames.txt
66
30
  - lib/zxcvbn.rb
31
+ - lib/zxcvbn/clock.rb
67
32
  - lib/zxcvbn/crack_time.rb
68
33
  - lib/zxcvbn/data.rb
69
34
  - lib/zxcvbn/dictionary_ranker.rb
@@ -88,36 +53,6 @@ files:
88
53
  - lib/zxcvbn/scorer.rb
89
54
  - lib/zxcvbn/tester.rb
90
55
  - lib/zxcvbn/version.rb
91
- - spec/dictionary_ranker_spec.rb
92
- - spec/feedback_giver_spec.rb
93
- - spec/matchers/date_spec.rb
94
- - spec/matchers/dictionary_spec.rb
95
- - spec/matchers/digits_spec.rb
96
- - spec/matchers/l33t_spec.rb
97
- - spec/matchers/repeat_spec.rb
98
- - spec/matchers/sequences_spec.rb
99
- - spec/matchers/spatial_spec.rb
100
- - spec/matchers/year_spec.rb
101
- - spec/omnimatch_spec.rb
102
- - spec/scorer_spec.rb
103
- - spec/scoring/crack_time_spec.rb
104
- - spec/scoring/entropy_spec.rb
105
- - spec/scoring/math_spec.rb
106
- - spec/spec_helper.rb
107
- - spec/support/js_helpers.rb
108
- - spec/support/js_source/adjacency_graphs.js
109
- - spec/support/js_source/compiled.js
110
- - spec/support/js_source/frequency_lists.js
111
- - spec/support/js_source/init.coffee
112
- - spec/support/js_source/init.js
113
- - spec/support/js_source/matching.coffee
114
- - spec/support/js_source/matching.js
115
- - spec/support/js_source/scoring.coffee
116
- - spec/support/js_source/scoring.js
117
- - spec/support/matcher.rb
118
- - spec/tester_spec.rb
119
- - spec/zxcvbn_spec.rb
120
- - zxcvbn-ruby.gemspec
121
56
  homepage: http://github.com/envato/zxcvbn-ruby
122
57
  licenses:
123
58
  - MIT
@@ -127,7 +62,6 @@ metadata:
127
62
  documentation_uri: https://github.com/envato/zxcvbn-ruby/blob/HEAD/README.md
128
63
  homepage_uri: https://github.com/envato/zxcvbn-ruby
129
64
  source_code_uri: https://github.com/envato/zxcvbn-ruby
130
- post_install_message:
131
65
  rdoc_options: []
132
66
  require_paths:
133
67
  - lib
@@ -142,37 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
76
  - !ruby/object:Gem::Version
143
77
  version: '0'
144
78
  requirements: []
145
- rubygems_version: 3.2.3
146
- signing_key:
79
+ rubygems_version: 4.0.0
147
80
  specification_version: 4
148
81
  summary: ''
149
- test_files:
150
- - spec/dictionary_ranker_spec.rb
151
- - spec/feedback_giver_spec.rb
152
- - spec/matchers/date_spec.rb
153
- - spec/matchers/dictionary_spec.rb
154
- - spec/matchers/digits_spec.rb
155
- - spec/matchers/l33t_spec.rb
156
- - spec/matchers/repeat_spec.rb
157
- - spec/matchers/sequences_spec.rb
158
- - spec/matchers/spatial_spec.rb
159
- - spec/matchers/year_spec.rb
160
- - spec/omnimatch_spec.rb
161
- - spec/scorer_spec.rb
162
- - spec/scoring/crack_time_spec.rb
163
- - spec/scoring/entropy_spec.rb
164
- - spec/scoring/math_spec.rb
165
- - spec/spec_helper.rb
166
- - spec/support/js_helpers.rb
167
- - spec/support/js_source/adjacency_graphs.js
168
- - spec/support/js_source/compiled.js
169
- - spec/support/js_source/frequency_lists.js
170
- - spec/support/js_source/init.coffee
171
- - spec/support/js_source/init.js
172
- - spec/support/js_source/matching.coffee
173
- - spec/support/js_source/matching.js
174
- - spec/support/js_source/scoring.coffee
175
- - spec/support/js_source/scoring.js
176
- - spec/support/matcher.rb
177
- - spec/tester_spec.rb
178
- - spec/zxcvbn_spec.rb
82
+ test_files: []
@@ -1,23 +0,0 @@
1
- name: CI
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- test:
7
- strategy:
8
- fail-fast: false
9
- matrix:
10
- ruby: ['2.5', '2.6', '2.7', '3.0']
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - name: Checkout
15
- uses: actions/checkout@v2
16
- - name: Set up Ruby
17
- uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: ${{ matrix.ruby }}
20
- - name: Install dependencies
21
- run: bundle install
22
- - name: Run tests
23
- run: bundle exec rake
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- bin/
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --colour
data/CODE_OF_CONDUCT.md DELETED
@@ -1,130 +0,0 @@
1
-
2
- # Contributor Covenant Code of Conduct
3
-
4
- ## Our Pledge
5
-
6
- We as members, contributors, and leaders pledge to make participation in our
7
- community a harassment-free experience for everyone, regardless of age, body
8
- size, visible or invisible disability, ethnicity, sex characteristics, gender
9
- identity and expression, level of experience, education, socio-economic status,
10
- nationality, personal appearance, race, religion, or sexual identity
11
- and orientation.
12
-
13
- We pledge to act and interact in ways that contribute to an open, welcoming,
14
- diverse, inclusive, and healthy community.
15
-
16
- ## Our Standards
17
-
18
- Examples of behavior that contributes to a positive environment for our
19
- community include:
20
-
21
- * Demonstrating empathy and kindness toward other people
22
- * Being respectful of differing opinions, viewpoints, and experiences
23
- * Giving and gracefully accepting constructive feedback
24
- * Accepting responsibility and apologizing to those affected by our mistakes,
25
- and learning from the experience
26
- * Focusing on what is best not just for us as individuals, but for the
27
- overall community
28
-
29
- Examples of unacceptable behavior include:
30
-
31
- * The use of sexualized language or imagery, and sexual attention or
32
- advances of any kind
33
- * Trolling, insulting or derogatory comments, and personal or political attacks
34
- * Public or private harassment
35
- * Publishing others' private information, such as a physical or email
36
- address, without their explicit permission
37
- * Other conduct which could reasonably be considered inappropriate in a
38
- professional setting
39
-
40
- ## Enforcement Responsibilities
41
-
42
- Community leaders are responsible for clarifying and enforcing our standards of
43
- acceptable behavior and will take appropriate and fair corrective action in
44
- response to any behavior that they deem inappropriate, threatening, offensive,
45
- or harmful.
46
-
47
- Community leaders have the right and responsibility to remove, edit, or reject
48
- comments, commits, code, wiki edits, issues, and other contributions that are
49
- not aligned to this Code of Conduct, and will communicate reasons for moderation
50
- decisions when appropriate.
51
-
52
- ## Scope
53
-
54
- This Code of Conduct applies within all community spaces, and also applies when
55
- an individual is officially representing the community in public spaces.
56
- Examples of representing our community include using an official e-mail address,
57
- posting via an official social media account, or acting as an appointed
58
- representative at an online or offline event.
59
-
60
- ## Enforcement
61
-
62
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
- reported to the community leaders responsible for enforcement at
64
- pete.johns@envato.com
65
- All complaints will be reviewed and investigated promptly and fairly.
66
-
67
- All community leaders are obligated to respect the privacy and security of the
68
- reporter of any incident.
69
-
70
- ## Enforcement Guidelines
71
-
72
- Community leaders will follow these Community Impact Guidelines in determining
73
- the consequences for any action they deem in violation of this Code of Conduct:
74
-
75
- ### 1. Correction
76
-
77
- **Community Impact**: Use of inappropriate language or other behavior deemed
78
- unprofessional or unwelcome in the community.
79
-
80
- **Consequence**: A private, written warning from community leaders, providing
81
- clarity around the nature of the violation and an explanation of why the
82
- behavior was inappropriate. A public apology may be requested.
83
-
84
- ### 2. Warning
85
-
86
- **Community Impact**: A violation through a single incident or series
87
- of actions.
88
-
89
- **Consequence**: A warning with consequences for continued behavior. No
90
- interaction with the people involved, including unsolicited interaction with
91
- those enforcing the Code of Conduct, for a specified period of time. This
92
- includes avoiding interactions in community spaces as well as external channels
93
- like social media. Violating these terms may lead to a temporary or
94
- permanent ban.
95
-
96
- ### 3. Temporary Ban
97
-
98
- **Community Impact**: A serious violation of community standards, including
99
- sustained inappropriate behavior.
100
-
101
- **Consequence**: A temporary ban from any sort of interaction or public
102
- communication with the community for a specified period of time. No public or
103
- private interaction with the people involved, including unsolicited interaction
104
- with those enforcing the Code of Conduct, is allowed during this period.
105
- Violating these terms may lead to a permanent ban.
106
-
107
- ### 4. Permanent Ban
108
-
109
- **Community Impact**: Demonstrating a pattern of violation of community
110
- standards, including sustained inappropriate behavior, harassment of an
111
- individual, or aggression toward or disparagement of classes of individuals.
112
-
113
- **Consequence**: A permanent ban from any sort of public interaction within
114
- the community.
115
-
116
- ## Attribution
117
-
118
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
- version 2.0, available at
120
- https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
121
-
122
- Community Impact Guidelines were inspired by [Mozilla's code of conduct
123
- enforcement ladder](https://github.com/mozilla/diversity).
124
-
125
- [homepage]: https://www.contributor-covenant.org
126
-
127
- For answers to common questions about this code of conduct, see the FAQ at
128
- https://www.contributor-covenant.org/faq. Translations are available at
129
- https://www.contributor-covenant.org/translations.
130
-
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem 'guard'
7
- gem 'guard-bundler', require: false
8
- gem 'guard-rspec', require: false
9
- gem 'rake'
10
- end
data/Guardfile DELETED
@@ -1,26 +0,0 @@
1
- guard :bundler do
2
- require 'guard/bundler'
3
- require 'guard/bundler/verify'
4
- helper = Guard::Bundler::Verify.new
5
-
6
- files = ['Gemfile']
7
- files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
8
-
9
- # Assume files are symlinked from somewhere
10
- files.each { |file| watch(helper.real_path(file)) }
11
- end
12
-
13
- guard :rspec, cmd: "bundle exec rspec" do
14
- require "guard/rspec/dsl"
15
- dsl = Guard::RSpec::Dsl.new(self)
16
-
17
- # RSpec files
18
- rspec = dsl.rspec
19
- watch(rspec.spec_helper) { rspec.spec_dir }
20
- watch(rspec.spec_support) { rspec.spec_dir }
21
- watch(rspec.spec_files)
22
-
23
- # Ruby files
24
- ruby = dsl.ruby
25
- dsl.watch_spec_files_for(ruby.lib_files)
26
- end
data/Rakefile DELETED
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
3
- require "bundler/setup"
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new('spec')
7
- task default: [:spec]
8
-
9
- task :console do
10
- require 'zxcvbn'
11
- require './spec/support/js_helpers'
12
- include JsHelpers
13
- require 'irb'
14
- ARGV.clear
15
- IRB.start
16
- 1
17
- end
18
-
19
- task :compile_coffeescript do
20
- `coffee --compile --bare spec/support/js_source/{matching,scoring,init}.coffee`
21
- `cat spec/support/js_source/{matching,scoring,adjacency_graphs,frequency_lists,init}.js > spec/support/js_source/compiled.js`
22
- end
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Zxcvbn::DictionaryRanker do
4
- describe '.rank_dictionaries' do
5
- it 'ranks word lists' do
6
- result = Zxcvbn::DictionaryRanker.rank_dictionaries({:test => ['ABC', 'def'],
7
- :test2 => ['def', 'ABC']})
8
- expect(result[:test]).to eq({'abc' => 1, 'def' => 2})
9
- expect(result[:test2]).to eq({'def' => 1, 'abc' => 2})
10
- end
11
- end
12
- end
@@ -1,212 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Zxcvbn::FeedbackGiver do
4
- # NOTE: We go in via the tester because the `FeedbackGiver` relies on both
5
- # Omnimatch and the Scorer, which are troublesome to wire up for tests
6
- let(:tester) { Zxcvbn::Tester.new }
7
-
8
- describe '.get_feedback' do
9
- it "gives empty feedback when a password's score is good" do
10
- feedback = tester.test('5815A30BE798').feedback
11
-
12
- expect(feedback).to be_a Zxcvbn::Feedback
13
- expect(feedback.warning).to be_nil
14
- expect(feedback.suggestions).to be_empty
15
- end
16
-
17
- it 'gives general feedback when a password is empty' do
18
- feedback = tester.test('').feedback
19
-
20
- expect(feedback).to be_a Zxcvbn::Feedback
21
- expect(feedback.warning).to be_nil
22
- expect(feedback.suggestions).to contain_exactly(
23
- 'Use a few words, avoid common phrases',
24
- 'No need for symbols, digits, or uppercase letters'
25
- )
26
- end
27
-
28
- it "gives general feedback when a password is poor but doesn't match any heuristics" do
29
- feedback = tester.test(':005:0').feedback
30
-
31
- expect(feedback).to be_a Zxcvbn::Feedback
32
- expect(feedback.warning).to be_nil
33
- expect(feedback.suggestions).to contain_exactly(
34
- 'Add another word or two. Uncommon words are better.'
35
- )
36
- end
37
-
38
- describe 'gives specific feedback' do
39
- describe 'for dictionary passwords' do
40
- it 'that are extremely common' do
41
- feedback = tester.test('password').feedback
42
-
43
- expect(feedback).to be_a Zxcvbn::Feedback
44
- expect(feedback.warning).to eql('This is a top-10 common password')
45
- expect(feedback.suggestions).to contain_exactly(
46
- 'Add another word or two. Uncommon words are better.'
47
- )
48
- end
49
-
50
- it 'that are very, very common' do
51
- feedback = tester.test('letmein').feedback
52
-
53
- expect(feedback).to be_a Zxcvbn::Feedback
54
- expect(feedback.warning).to eql('This is a top-100 common password')
55
- expect(feedback.suggestions).to contain_exactly(
56
- 'Add another word or two. Uncommon words are better.'
57
- )
58
- end
59
-
60
- it 'that are very common' do
61
- feedback = tester.test('playstation').feedback
62
-
63
- expect(feedback).to be_a Zxcvbn::Feedback
64
- expect(feedback.warning).to eql('This is a very common password')
65
- expect(feedback.suggestions).to contain_exactly(
66
- 'Add another word or two. Uncommon words are better.'
67
- )
68
- end
69
-
70
- it 'that are common and you tried to use l33tsp33k' do
71
- feedback = tester.test('pl4yst4ti0n').feedback
72
-
73
- expect(feedback).to be_a Zxcvbn::Feedback
74
- expect(feedback.warning).to eql(
75
- 'This is similar to a commonly used password'
76
- )
77
- expect(feedback.suggestions).to contain_exactly(
78
- 'Add another word or two. Uncommon words are better.',
79
- "Predictable substitutions like '@' instead of 'a' don't help very much"
80
- )
81
- end
82
-
83
- it 'that are common and you capitalised the start' do
84
- feedback = tester.test('Password').feedback
85
-
86
- expect(feedback).to be_a Zxcvbn::Feedback
87
- expect(feedback.warning).to eql(
88
- 'This is a top-10 common password'
89
- )
90
- expect(feedback.suggestions).to contain_exactly(
91
- 'Add another word or two. Uncommon words are better.',
92
- "Capitalization doesn't help very much"
93
- )
94
- end
95
-
96
- it 'that are common and you capitalised the whole thing' do
97
- feedback = tester.test('PASSWORD').feedback
98
-
99
- expect(feedback).to be_a Zxcvbn::Feedback
100
- expect(feedback.warning).to eql(
101
- 'This is a top-10 common password'
102
- )
103
- expect(feedback.suggestions).to contain_exactly(
104
- 'Add another word or two. Uncommon words are better.',
105
- 'All-uppercase is almost as easy to guess as all-lowercase'
106
- )
107
- end
108
-
109
- it 'that contain a common first name or last name' do
110
- feedback = tester.test('jessica').feedback
111
-
112
- expect(feedback).to be_a Zxcvbn::Feedback
113
- expect(feedback.warning).to eql(
114
- 'Names and surnames by themselves are easy to guess'
115
- )
116
- expect(feedback.suggestions).to contain_exactly(
117
- 'Add another word or two. Uncommon words are better.'
118
- )
119
-
120
- feedback = tester.test('smith').feedback
121
-
122
- expect(feedback).to be_a Zxcvbn::Feedback
123
- expect(feedback.warning).to eql(
124
- 'Names and surnames by themselves are easy to guess'
125
- )
126
- expect(feedback.suggestions).to contain_exactly(
127
- 'Add another word or two. Uncommon words are better.'
128
- )
129
- end
130
-
131
- it 'that contain a common name and surname' do
132
- feedback = tester.test('jessica smith').feedback
133
-
134
- expect(feedback).to be_a Zxcvbn::Feedback
135
- expect(feedback.warning).to eql(
136
- 'Common names and surnames are easy to guess'
137
- )
138
- expect(feedback.suggestions).to contain_exactly(
139
- 'Add another word or two. Uncommon words are better.'
140
- )
141
- end
142
- end
143
-
144
- describe 'for spatial passwords' do
145
- it 'that contain a straight keyboard row' do
146
- feedback = tester.test('1qaz').feedback
147
-
148
- expect(feedback).to be_a Zxcvbn::Feedback
149
- expect(feedback.warning).to eql(
150
- 'Straight rows of keys are easy to guess'
151
- )
152
- expect(feedback.suggestions).to contain_exactly(
153
- 'Add another word or two. Uncommon words are better.',
154
- 'Use a longer keyboard pattern with more turns'
155
- )
156
- end
157
-
158
- it 'that contain a keyboard pattern with one turn' do
159
- feedback = tester.test('zaqwer').feedback
160
-
161
- expect(feedback).to be_a Zxcvbn::Feedback
162
- expect(feedback.warning).to eql(
163
- 'Short keyboard patterns are easy to guess'
164
- )
165
- expect(feedback.suggestions).to contain_exactly(
166
- 'Add another word or two. Uncommon words are better.',
167
- 'Use a longer keyboard pattern with more turns'
168
- )
169
- end
170
- end
171
-
172
- it 'for passwords with repeated characters' do
173
- feedback = tester.test('zzz').feedback
174
-
175
- expect(feedback).to be_a Zxcvbn::Feedback
176
- expect(feedback.warning).to eql(
177
- 'Repeats like "aaa" are easy to guess'
178
- )
179
- expect(feedback.suggestions).to contain_exactly(
180
- 'Add another word or two. Uncommon words are better.',
181
- 'Avoid repeated words and characters'
182
- )
183
- end
184
-
185
- it 'for passwords with sequential characters' do
186
- feedback = tester.test('pqrpqrpqr').feedback
187
-
188
- expect(feedback).to be_a Zxcvbn::Feedback
189
- expect(feedback.warning).to eql(
190
- 'Sequences like abc or 6543 are easy to guess'
191
- )
192
- expect(feedback.suggestions).to contain_exactly(
193
- 'Add another word or two. Uncommon words are better.',
194
- 'Avoid sequences'
195
- )
196
- end
197
-
198
- it 'for passwords containing dates' do
199
- feedback = tester.test('testing02\12\1997').feedback
200
-
201
- expect(feedback).to be_a Zxcvbn::Feedback
202
- expect(feedback.warning).to eql(
203
- 'Dates are often easy to guess'
204
- )
205
- expect(feedback.suggestions).to contain_exactly(
206
- 'Add another word or two. Uncommon words are better.',
207
- 'Avoid dates and years that are associated with you'
208
- )
209
- end
210
- end
211
- end
212
- end