pwqgen.rb 0.0.6 → 0.1.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -10
- data/ChangeLog +9 -0
- data/bin/pwqgen.rb +8 -27
- data/features/password_generation.feature +3 -3
- data/lib/pwqgen/pwqgen.rb +2 -3
- data/lib/pwqgen/version.rb +1 -1
- data/lib/pwqgen/wordlist.rb +6417 -2754
- data/spec/lib/pwqgen_spec.rb +32 -26
- metadata +2 -2
data/spec/lib/pwqgen_spec.rb
CHANGED
@@ -3,57 +3,63 @@ require 'spec_helper'
|
|
3
3
|
describe Pwqgen do
|
4
4
|
it "should return a random password" do
|
5
5
|
password = Pwqgen.generate
|
6
|
-
password.
|
7
|
-
password.
|
8
|
-
password.
|
9
|
-
password.length.
|
6
|
+
expect(password).not_to be_nil
|
7
|
+
expect(password).not_to be_empty
|
8
|
+
expect(password).to be_kind_of(String)
|
9
|
+
expect(password.length).to be >= (9 + 3 - 1) # remember word separators
|
10
|
+
expect(password.length).to be <= (27 + 3 - 1)
|
10
11
|
end
|
11
12
|
|
12
13
|
it "should return a short random password when given a length of 1" do
|
13
14
|
password = Pwqgen.generate 1
|
14
|
-
password.
|
15
|
-
password.
|
16
|
-
password.
|
17
|
-
password.length.
|
15
|
+
expect(password).not_to be_nil
|
16
|
+
expect(password).not_to be_empty
|
17
|
+
expect(password).to be_kind_of(String)
|
18
|
+
expect(password.length).to be >= (3 + 1 - 1)
|
19
|
+
expect(password.length).to be <= (9 + 1 - 1)
|
18
20
|
end
|
19
21
|
|
20
22
|
it "should return a longer random password when given a length of 5" do
|
21
23
|
password = Pwqgen.generate 5
|
22
|
-
password.
|
23
|
-
password.
|
24
|
-
password.
|
25
|
-
password.length.
|
24
|
+
expect(password).not_to be_nil
|
25
|
+
expect(password).not_to be_empty
|
26
|
+
expect(password).to be_kind_of(String)
|
27
|
+
expect(password.length).to be >= (15 + 5 - 1)
|
28
|
+
expect(password.length).to be <= (45 + 5 - 1)
|
26
29
|
end
|
27
30
|
|
28
31
|
it "should return a Pwqgen::Generator object when Pwqgen.new is called" do
|
29
32
|
obj = Pwqgen.new
|
30
|
-
obj.
|
31
|
-
obj.
|
33
|
+
expect(obj).not_to be_nil
|
34
|
+
expect(obj).to be_an_instance_of(Pwqgen::Generator)
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
35
38
|
describe Pwqgen::Generator do
|
36
39
|
it "should return a random password" do
|
37
40
|
password = Pwqgen::Generator.new.generate
|
38
|
-
password.
|
39
|
-
password.
|
40
|
-
password.
|
41
|
-
password.length.
|
41
|
+
expect(password).not_to be_nil
|
42
|
+
expect(password).not_to be_empty
|
43
|
+
expect(password).to be_kind_of(String)
|
44
|
+
expect(password.length).to be >= (9 + 3 - 1)
|
45
|
+
expect(password.length).to be <= (27 + 3 - 1)
|
42
46
|
end
|
43
47
|
|
44
48
|
it "should return a short random password when given a length of 1" do
|
45
49
|
password = Pwqgen::Generator.new.generate 1
|
46
|
-
password.
|
47
|
-
password.
|
48
|
-
password.
|
49
|
-
password.length.
|
50
|
+
expect(password).not_to be_nil
|
51
|
+
expect(password).not_to be_empty
|
52
|
+
expect(password).to be_kind_of(String)
|
53
|
+
expect(password.length).to be >= (3 + 1 - 1)
|
54
|
+
expect(password.length).to be <= (9 + 1 - 1)
|
50
55
|
end
|
51
56
|
|
52
57
|
it "should return a longer random password when given a length of 5" do
|
53
58
|
password = Pwqgen::Generator.new.generate 5
|
54
|
-
password.
|
55
|
-
password.
|
56
|
-
password.
|
57
|
-
password.length.
|
59
|
+
expect(password).not_to be_nil
|
60
|
+
expect(password).not_to be_empty
|
61
|
+
expect(password).to be_kind_of(String)
|
62
|
+
expect(password.length).to be >= (15 + 5 - 1)
|
63
|
+
expect(password.length).to be <= (45 + 5 - 1)
|
58
64
|
end
|
59
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwqgen.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronald Ip
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|