require 'pwm' describe Pwm do context 'The default set of characters' do it 'should include all upper-case letters' do ('A'..'Z').each do |letter| Pwm.characters.should include(letter) end end it 'should include all lower-case letters' do ('a'..'z').each do |letter| Pwm.characters.should include(letter) end end it 'should include all digits 2 through 9' do ('2'..'9').each do |letter| Pwm.characters.should include(letter) end end end context 'The password method' do context 'when given a length' do it 'should generate a password of that length' do Pwm.password(8).length.should == 8 end end context 'when not given a length' do it 'should generate a 16-character password' do Pwm.password.length.should == 16 end end end end