passwd 0.1.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +28 -0
- data/.gitignore +11 -17
- data/.rubocop.yml +168 -0
- data/.ruby-version +1 -0
- data/Gemfile +3 -6
- data/LICENSE +21 -0
- data/README.md +89 -138
- data/Rakefile +5 -6
- data/bin/console +7 -0
- data/bin/setup +8 -0
- data/lib/generators/passwd/install/USAGE +5 -0
- data/lib/generators/passwd/install/install_generator.rb +10 -0
- data/lib/generators/passwd/install/templates/passwd.rb +21 -0
- data/lib/passwd.rb +33 -6
- data/lib/passwd/config.rb +27 -0
- data/lib/passwd/errors.rb +4 -0
- data/lib/passwd/rails/action_controller_ext.rb +78 -0
- data/lib/passwd/rails/active_record_ext.rb +35 -0
- data/lib/passwd/railtie.rb +18 -0
- data/lib/passwd/version.rb +2 -4
- data/passwd.gemspec +20 -11
- metadata +83 -53
- data/.coveralls.yml +0 -1
- data/.travis.yml +0 -10
- data/LICENSE.txt +0 -22
- data/lib/passwd/active_record.rb +0 -58
- data/lib/passwd/base.rb +0 -72
- data/lib/passwd/configuration/abstract_config.rb +0 -36
- data/lib/passwd/configuration/config.rb +0 -23
- data/lib/passwd/configuration/policy.rb +0 -46
- data/lib/passwd/configuration/tmp_config.rb +0 -18
- data/lib/passwd/password.rb +0 -41
- data/samples/activerecord/user.rake +0 -28
- data/spec/passwd/active_record_spec.rb +0 -142
- data/spec/passwd/base_spec.rb +0 -224
- data/spec/passwd/configuration/config_spec.rb +0 -242
- data/spec/passwd/configuration/policy_spec.rb +0 -133
- data/spec/passwd/configuration/tmp_config_spec.rb +0 -257
- data/spec/passwd/password_spec.rb +0 -150
- data/spec/spec_helper.rb +0 -23
@@ -1,133 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe Passwd::Policy do
|
6
|
-
let(:policy) {Passwd::Policy.instance}
|
7
|
-
|
8
|
-
describe "defined accessors" do
|
9
|
-
it "defined min_length" do
|
10
|
-
expect(policy.respond_to? :min_length).to be_true
|
11
|
-
end
|
12
|
-
|
13
|
-
it "defined require_lower" do
|
14
|
-
expect(policy.respond_to? :require_lower).to be_true
|
15
|
-
end
|
16
|
-
|
17
|
-
it "defined require_upper" do
|
18
|
-
expect(policy.respond_to? :require_upper).to be_true
|
19
|
-
end
|
20
|
-
|
21
|
-
it "defined require_number" do
|
22
|
-
expect(policy.respond_to? :require_number).to be_true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#initialize" do
|
27
|
-
it "min_length should be a default" do
|
28
|
-
expect(policy.min_length).to eq(8)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "require_lower should be a default" do
|
32
|
-
expect(policy.require_lower).to be_true
|
33
|
-
end
|
34
|
-
|
35
|
-
it "require_upper should be a default" do
|
36
|
-
expect(policy.require_upper).to be_false
|
37
|
-
end
|
38
|
-
|
39
|
-
it "require_number should be a default" do
|
40
|
-
expect(policy.require_number).to be_true
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "#configure" do
|
45
|
-
before {
|
46
|
-
policy.configure do |c|
|
47
|
-
c.min_length = 20
|
48
|
-
c.require_lower = false
|
49
|
-
c.require_upper = true
|
50
|
-
c.require_number = false
|
51
|
-
end
|
52
|
-
}
|
53
|
-
|
54
|
-
it "set min_length from block" do
|
55
|
-
expect(policy.min_length).to eq(20)
|
56
|
-
end
|
57
|
-
|
58
|
-
it "set require_lower from block" do
|
59
|
-
expect(policy.require_lower).to be_false
|
60
|
-
end
|
61
|
-
|
62
|
-
it "set require_upper from block" do
|
63
|
-
expect(policy.require_upper).to be_true
|
64
|
-
end
|
65
|
-
|
66
|
-
it "set require_number from block" do
|
67
|
-
expect(policy.require_number).to be_false
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe "#valid?" do
|
72
|
-
let(:config) {Passwd::Config.instance}
|
73
|
-
|
74
|
-
it "valid password should be valid" do
|
75
|
-
expect(policy.valid?("secret1234", config)).to be_true
|
76
|
-
end
|
77
|
-
|
78
|
-
it "short password should not valid" do
|
79
|
-
expect(policy.valid?("short1", config)).to be_false
|
80
|
-
end
|
81
|
-
|
82
|
-
it "password should not valid if not contain lower case" do
|
83
|
-
expect(policy.valid?("NOTLOWER12", config)).to be_false
|
84
|
-
end
|
85
|
-
|
86
|
-
it "password should not valid if not contain upper case" do
|
87
|
-
policy.configure {|c| c.require_upper = true}
|
88
|
-
expect(policy.valid?("notupper12", config)).to be_false
|
89
|
-
end
|
90
|
-
|
91
|
-
it "password should not valid if not contain number" do
|
92
|
-
expect(policy.valid?("notnumber", config)).to be_false
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe "#include_char?" do
|
97
|
-
it "should be return true if contains" do
|
98
|
-
expect(policy.include_char?(("a".."z").to_a, "contains")).to be_true
|
99
|
-
end
|
100
|
-
|
101
|
-
it "should be return false if not contains" do
|
102
|
-
expect(policy.include_char?(("a".."z").to_a, "NOTCONTAINS")).to be_false
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe "#reset" do
|
107
|
-
before {
|
108
|
-
policy.configure do |c|
|
109
|
-
c.min_length = 20
|
110
|
-
c.require_lower = false
|
111
|
-
c.require_upper = true
|
112
|
-
c.require_number = false
|
113
|
-
end
|
114
|
-
policy.reset
|
115
|
-
}
|
116
|
-
|
117
|
-
it "min_length should be a default" do
|
118
|
-
expect(policy.min_length).to eq(8)
|
119
|
-
end
|
120
|
-
|
121
|
-
it "require_lower should be a default" do
|
122
|
-
expect(policy.require_lower).to be_true
|
123
|
-
end
|
124
|
-
|
125
|
-
it "require_upper should be a default" do
|
126
|
-
expect(policy.require_upper).to be_false
|
127
|
-
end
|
128
|
-
|
129
|
-
it "require_number should be a default" do
|
130
|
-
expect(policy.require_number).to be_true
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
@@ -1,257 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe Passwd::TmpConfig do
|
6
|
-
let(:config) {Passwd::Config.instance}
|
7
|
-
|
8
|
-
def tmp_config(options={})
|
9
|
-
Passwd::TmpConfig.new(Passwd::Config.instance, options)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "defined accessors" do
|
13
|
-
it "defined length" do
|
14
|
-
expect(tmp_config.respond_to? :length).to be_true
|
15
|
-
end
|
16
|
-
|
17
|
-
it "defined lower" do
|
18
|
-
expect(tmp_config.respond_to? :lower).to be_true
|
19
|
-
end
|
20
|
-
|
21
|
-
it "defined upper" do
|
22
|
-
expect(tmp_config.respond_to? :upper).to be_true
|
23
|
-
end
|
24
|
-
|
25
|
-
it "defined number" do
|
26
|
-
expect(tmp_config.respond_to? :number).to be_true
|
27
|
-
end
|
28
|
-
|
29
|
-
it "defined letters_lower" do
|
30
|
-
expect(tmp_config.respond_to? :letters_lower).to be_true
|
31
|
-
end
|
32
|
-
|
33
|
-
it "defined letters_upper" do
|
34
|
-
expect(tmp_config.respond_to? :letters_upper).to be_true
|
35
|
-
end
|
36
|
-
|
37
|
-
it "defined letters_number" do
|
38
|
-
expect(tmp_config.respond_to? :letters_number).to be_true
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe "#initialize" do
|
43
|
-
context "with empty options" do
|
44
|
-
it "length should be a default" do
|
45
|
-
expect(tmp_config.length).to eq(8)
|
46
|
-
end
|
47
|
-
|
48
|
-
it "lower should be a default" do
|
49
|
-
expect(tmp_config.lower).to be_true
|
50
|
-
end
|
51
|
-
|
52
|
-
it "upper should be a default" do
|
53
|
-
expect(tmp_config.upper).to be_true
|
54
|
-
end
|
55
|
-
|
56
|
-
it "number should be a default" do
|
57
|
-
expect(tmp_config.number).to be_true
|
58
|
-
end
|
59
|
-
|
60
|
-
it "letters_lower should be a default" do
|
61
|
-
expect(tmp_config.letters_lower).to eq(("a".."z").to_a)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "letters_upper should be a default" do
|
65
|
-
expect(tmp_config.letters_upper).to eq(("A".."Z").to_a)
|
66
|
-
end
|
67
|
-
|
68
|
-
it "letters_number should be a default" do
|
69
|
-
expect(tmp_config.letters_number).to eq(("0".."9").to_a)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "with options" do
|
74
|
-
it "length should be a specified params" do
|
75
|
-
expect(tmp_config(length: 10).length).to eq(10)
|
76
|
-
expect(config.length).to eq(8)
|
77
|
-
end
|
78
|
-
|
79
|
-
it "lower should be a specified params" do
|
80
|
-
expect(tmp_config(lower: false).lower).to be_false
|
81
|
-
expect(config.lower).to be_true
|
82
|
-
end
|
83
|
-
|
84
|
-
it "upper should be a specified params" do
|
85
|
-
expect(tmp_config(upper: false).upper).to be_false
|
86
|
-
expect(config.upper).to be_true
|
87
|
-
end
|
88
|
-
|
89
|
-
it "number should be a specified params" do
|
90
|
-
expect(tmp_config(number: false).number).to be_false
|
91
|
-
expect(config.number).to be_true
|
92
|
-
end
|
93
|
-
|
94
|
-
it "letters_lower should be a specified params" do
|
95
|
-
expect(tmp_config(letters_lower: ["a"]).letters_lower).to eq(["a"])
|
96
|
-
expect(config.letters_lower).to eq(("a".."z").to_a)
|
97
|
-
end
|
98
|
-
|
99
|
-
it "letters_upper should be a specified params" do
|
100
|
-
expect(tmp_config(letters_upper: ["A"]).letters_upper).to eq(["A"])
|
101
|
-
expect(config.letters_upper).to eq(("A".."Z").to_a)
|
102
|
-
end
|
103
|
-
|
104
|
-
it "letters_number should be a specified params" do
|
105
|
-
expect(tmp_config(letters_number: ["0"]).letters_number).to eq(["0"])
|
106
|
-
expect(config.letters_number).to eq(("0".."9").to_a)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe "#configure" do
|
112
|
-
let(:changed_tmp_config) do
|
113
|
-
tconf = tmp_config
|
114
|
-
tconf.configure do |c|
|
115
|
-
c.length = 20
|
116
|
-
c.lower = false
|
117
|
-
c.upper = false
|
118
|
-
c.number = false
|
119
|
-
c.letters_lower = ["a"]
|
120
|
-
c.letters_upper = ["A"]
|
121
|
-
c.letters_number = ["0"]
|
122
|
-
end
|
123
|
-
tconf
|
124
|
-
end
|
125
|
-
|
126
|
-
it "set length from block" do
|
127
|
-
expect(changed_tmp_config.length).to eq(20)
|
128
|
-
expect(config.length).to eq(8)
|
129
|
-
end
|
130
|
-
|
131
|
-
it "set lower from block" do
|
132
|
-
expect(changed_tmp_config.lower).to be_false
|
133
|
-
expect(config.lower).to be_true
|
134
|
-
end
|
135
|
-
|
136
|
-
it "set upper from block" do
|
137
|
-
expect(changed_tmp_config.upper).to be_false
|
138
|
-
expect(config.upper).to be_true
|
139
|
-
end
|
140
|
-
|
141
|
-
it "set number from block" do
|
142
|
-
expect(changed_tmp_config.number).to be_false
|
143
|
-
expect(config.number).to be_true
|
144
|
-
end
|
145
|
-
|
146
|
-
it "set letters_lower from block" do
|
147
|
-
expect(changed_tmp_config.letters_lower).to eq(["a"])
|
148
|
-
expect(config.letters_lower).to eq(("a".."z").to_a)
|
149
|
-
end
|
150
|
-
|
151
|
-
it "set letters_upper from block" do
|
152
|
-
expect(changed_tmp_config.letters_upper).to eq(["A"])
|
153
|
-
expect(config.letters_upper).to eq(("A".."Z").to_a)
|
154
|
-
end
|
155
|
-
|
156
|
-
it "set letters_number from block" do
|
157
|
-
expect(changed_tmp_config.letters_number).to eq(["0"])
|
158
|
-
expect(config.letters_number).to eq(("0".."9").to_a)
|
159
|
-
end
|
160
|
-
|
161
|
-
it "raise error unknown setting" do
|
162
|
-
expect {
|
163
|
-
tmp_config.configure do |c|
|
164
|
-
c.unknown = true
|
165
|
-
end
|
166
|
-
}.to raise_error
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
describe "#merge" do
|
171
|
-
let(:default_tmp_config) {tmp_config}
|
172
|
-
|
173
|
-
it "set length from hash" do
|
174
|
-
default_tmp_config.merge(length: 10)
|
175
|
-
expect(default_tmp_config.length).to eq(10)
|
176
|
-
expect(config.length).to eq(8)
|
177
|
-
end
|
178
|
-
|
179
|
-
it "set lower from hash" do
|
180
|
-
default_tmp_config.merge(lower: false)
|
181
|
-
expect(default_tmp_config.lower).to be_false
|
182
|
-
expect(config.lower).to be_true
|
183
|
-
end
|
184
|
-
|
185
|
-
it "set upper from hash" do
|
186
|
-
default_tmp_config.merge(upper: false)
|
187
|
-
expect(default_tmp_config.upper).to be_false
|
188
|
-
expect(config.upper).to be_true
|
189
|
-
end
|
190
|
-
|
191
|
-
it "set number from hash" do
|
192
|
-
default_tmp_config.merge(number: false)
|
193
|
-
expect(default_tmp_config.number).to be_false
|
194
|
-
expect(config.number).to be_true
|
195
|
-
end
|
196
|
-
|
197
|
-
it "set letters_lower from hash" do
|
198
|
-
default_tmp_config.merge(letters_lower: ["a"])
|
199
|
-
expect(default_tmp_config.letters_lower).to eq(["a"])
|
200
|
-
expect(config.letters_lower).to eq(("a".."z").to_a)
|
201
|
-
end
|
202
|
-
|
203
|
-
it "set letters_upper from hash" do
|
204
|
-
default_tmp_config.merge(letters_upper: ["A"])
|
205
|
-
expect(default_tmp_config.letters_upper).to eq(["A"])
|
206
|
-
expect(config.letters_upper).to eq(("A".."Z").to_a)
|
207
|
-
end
|
208
|
-
|
209
|
-
it "set letters_number from hash" do
|
210
|
-
default_tmp_config.merge(letters_number: ["0"])
|
211
|
-
expect(default_tmp_config.letters_number).to eq(["0"])
|
212
|
-
expect(config.letters_number).to eq(("0".."9").to_a)
|
213
|
-
end
|
214
|
-
|
215
|
-
it "raise error unknown setting" do
|
216
|
-
expect {
|
217
|
-
tmp_config.merge(unknown: true)
|
218
|
-
}.to raise_error
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
describe "#letters" do
|
223
|
-
it "return Array object" do
|
224
|
-
expect(tmp_config.letters.is_a? Array).to be_true
|
225
|
-
end
|
226
|
-
|
227
|
-
it "all elements of the string" do
|
228
|
-
tmp_config.letters.each do |l|
|
229
|
-
expect(l.is_a? String).to be_true
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
it "return all letters" do
|
234
|
-
all_letters = ("a".."z").to_a.concat(("A".."Z").to_a).concat(("0".."9").to_a)
|
235
|
-
expect(tmp_config.letters).to eq(all_letters)
|
236
|
-
end
|
237
|
-
|
238
|
-
it "return except for the lower case" do
|
239
|
-
expect(tmp_config(lower: false).letters.include? "a").to be_false
|
240
|
-
end
|
241
|
-
|
242
|
-
it "return except for the upper case" do
|
243
|
-
expect(tmp_config(upper: false).letters.include? "A").to be_false
|
244
|
-
end
|
245
|
-
|
246
|
-
it "return except for the number case" do
|
247
|
-
expect(tmp_config(number: false).letters.include? "0").to be_false
|
248
|
-
end
|
249
|
-
|
250
|
-
it "raise error if letters is empty" do
|
251
|
-
tconf = tmp_config(lower: false, upper: false, number: false)
|
252
|
-
expect {
|
253
|
-
tconf.letters
|
254
|
-
}.to raise_error
|
255
|
-
end
|
256
|
-
end
|
257
|
-
end
|
@@ -1,150 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe Passwd::Password do
|
6
|
-
let(:password) {Passwd::Password.new}
|
7
|
-
|
8
|
-
describe "#initialize" do
|
9
|
-
context "with default params" do
|
10
|
-
let!(:password_text) {
|
11
|
-
password_text = Passwd.create
|
12
|
-
Passwd.should_receive(:create).and_return(password_text)
|
13
|
-
password_text
|
14
|
-
}
|
15
|
-
|
16
|
-
let!(:time_now) {
|
17
|
-
time_now = Time.now
|
18
|
-
Time.should_receive(:now).and_return(time_now)
|
19
|
-
time_now
|
20
|
-
}
|
21
|
-
|
22
|
-
it "@text should be a random password" do
|
23
|
-
expect(password.text.size).to eq(8)
|
24
|
-
expect(password.text).to eq(password_text)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "@salt_text should be a auto created" do
|
28
|
-
expect(password.salt_text).to eq(time_now.to_s)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "@salt_hash should be a hashed salt" do
|
32
|
-
expect(password.salt_hash).to eq(Passwd.hashing(time_now.to_s))
|
33
|
-
end
|
34
|
-
|
35
|
-
it "@password_hash should be a hashed password with salt" do
|
36
|
-
password_hash = Passwd.hashing("#{Passwd.hashing(time_now.to_s)}#{password_text}")
|
37
|
-
expect(password.hash).to eq(password_hash)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context "with custom params" do
|
42
|
-
let(:password_text) {Passwd.create}
|
43
|
-
let(:salt_text) {"salt"}
|
44
|
-
let!(:time_now) {
|
45
|
-
time_now = Time.now
|
46
|
-
Time.stub(:create).and_return(time_now)
|
47
|
-
time_now
|
48
|
-
}
|
49
|
-
|
50
|
-
it "@text is specified password" do
|
51
|
-
password = Passwd::Password.new(password: password_text)
|
52
|
-
expect(password.text).to eq(password_text)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "@hash is hash of specified password" do
|
56
|
-
password = Passwd::Password.new(password: password_text)
|
57
|
-
password_hash = Passwd.hashing("#{Passwd.hashing(time_now.to_s)}#{password_text}")
|
58
|
-
expect(password.hash).to eq(password_hash)
|
59
|
-
end
|
60
|
-
|
61
|
-
it "@salt_text is specified salt" do
|
62
|
-
password = Passwd::Password.new(salt_text: salt_text)
|
63
|
-
expect(password.salt_text).to eq(salt_text)
|
64
|
-
end
|
65
|
-
|
66
|
-
it "@salt_hash is hash of specified salt" do
|
67
|
-
salt_hash = Passwd.hashing(salt_text)
|
68
|
-
password = Passwd::Password.new(salt_text: salt_text)
|
69
|
-
expect(password.salt_hash).to eq(salt_hash)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe "#text=" do
|
75
|
-
it "@text is changed" do
|
76
|
-
old_password = password.text
|
77
|
-
password.text = password.text.reverse
|
78
|
-
expect(password.text).not_to eq(old_password)
|
79
|
-
end
|
80
|
-
|
81
|
-
it "@hash is changed" do
|
82
|
-
old_hash = password.hash
|
83
|
-
new_password = password.text = password.text.reverse
|
84
|
-
expect(password.hash).not_to eq(old_hash)
|
85
|
-
expect(password.hash).to eq(Passwd.hashing("#{password.salt_hash}#{new_password}"))
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe "#hash=" do
|
90
|
-
it "@text is nil" do
|
91
|
-
password.hash = Passwd.hashing("secret")
|
92
|
-
expect(password.text).to be_nil
|
93
|
-
end
|
94
|
-
|
95
|
-
it "@hash is changed" do
|
96
|
-
old_hash = password.hash
|
97
|
-
password.hash = Passwd.hashing("secret")
|
98
|
-
expect(password.hash).not_to eq(old_hash)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe "#salt_text=" do
|
103
|
-
it "@salt_text is changed" do
|
104
|
-
old_salt = password.salt_text
|
105
|
-
password.salt_text = "salt"
|
106
|
-
expect(password.salt_text).not_to eq(old_salt)
|
107
|
-
end
|
108
|
-
|
109
|
-
it "@salt_hash is changed" do
|
110
|
-
old_salt = password.salt_hash
|
111
|
-
password.salt_text = "salt"
|
112
|
-
expect(password.salt_hash).not_to eq(old_salt)
|
113
|
-
end
|
114
|
-
|
115
|
-
it "@hash is changed" do
|
116
|
-
old_hash = password.hash
|
117
|
-
password.salt_text = "salt"
|
118
|
-
expect(password.hash).not_to eq(old_hash)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe "#salt_hash=" do
|
123
|
-
it "@salt_text is nil" do
|
124
|
-
password.salt_hash = Passwd.hashing("salt")
|
125
|
-
expect(password.salt_text).to eq(nil)
|
126
|
-
end
|
127
|
-
|
128
|
-
it "@salt_hash is changed" do
|
129
|
-
old_salt_hash = password.salt_hash
|
130
|
-
password.salt_hash = Passwd.hashing("salt")
|
131
|
-
expect(password.salt_hash).not_to eq(old_salt_hash)
|
132
|
-
end
|
133
|
-
|
134
|
-
it "@hash is changed" do
|
135
|
-
old_hash = password.hash
|
136
|
-
password.salt_hash = Passwd.hashing("salt")
|
137
|
-
expect(password.hash).not_to eq(old_hash)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
describe "#==" do
|
142
|
-
it "return true with valid password" do
|
143
|
-
expect(password == password.text).to be_true
|
144
|
-
end
|
145
|
-
|
146
|
-
it "return false with invalid password" do
|
147
|
-
expect(password == "secret").to be_false
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|