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.
@@ -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.should_not be_nil
7
- password.should_not be_empty
8
- password.should be_kind_of(String)
9
- password.length.should be_within(5).of(15)
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.should_not be_nil
15
- password.should_not be_empty
16
- password.should be_kind_of(String)
17
- password.length.should be_within(2).of(4)
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.should_not be_nil
23
- password.should_not be_empty
24
- password.should be_kind_of(String)
25
- password.length.should be_within(8).of(27)
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.should_not be_nil
31
- obj.should be_an_instance_of(Pwqgen::Generator)
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.should_not be_nil
39
- password.should_not be_empty
40
- password.should be_kind_of(String)
41
- password.length.should be_within(5).of(15)
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.should_not be_nil
47
- password.should_not be_empty
48
- password.should be_kind_of(String)
49
- password.length.should be_within(2).of(4)
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.should_not be_nil
55
- password.should_not be_empty
56
- password.should be_kind_of(String)
57
- password.length.should be_within(8).of(27)
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.6
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: 2016-09-07 00:00:00.000000000 Z
11
+ date: 2017-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt