spec/pwm_spec.rb in pwm-1.0.3 vs spec/pwm_spec.rb in pwm-1.1.0
- old
+ new
@@ -15,10 +15,15 @@
it 'includes all digits 2 through 9' do
('2'..'9').each do |letter|
Pwm.characters.should include(letter)
end
end
+ it 'does not include I, O, l, 0, or 1' do
+ %w(I O l 0 1).each do |letter|
+ Pwm.characters.should_not include(letter)
+ end
+ end
end
context 'The password method' do
context 'when given a length' do
it 'generates a password of that length' do
@@ -26,9 +31,20 @@
end
end
context 'when not given a length' do
it 'generates a 16-character password' do
Pwm.password.length.should == 16
+ end
+ end
+ context 'generates passwords containing' do
+ it 'at least one upper-case letter' do
+ Pwm.password.should match(/[A-Z]/)
+ end
+ it 'at least one lower-case letter' do
+ Pwm.password.should match(/[a-z]/)
+ end
+ it 'at least one number' do
+ Pwm.password.should match(/[2-9]/)
end
end
end
end