Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- context "password requires change after certain time" do
- before :each do
- @password = "about_time"
- @salt = "not_a_rhyme"
- @user = mock_model(User)
- archived_passwords = mock
- most_recent_archived_pw = mock_model(ArchivedPassword,
- :password => PasswordHelper::hash(@password, @salt),
- :salt => @salt,
- :created_at => Time.now - 90.days)
- @policy = Factory.build(:password_policy_basic)
- @policy.user = @user
- @policy.change_time = 90
- @user.should_receive(:archived_passwords).and_return(archived_passwords)
- archived_passwords.should_receive(:previous).with(1).
- and_return([most_recent_archived_pw])
- end
- it 'should prevent passwords that match the expired password' do
- @policy.allows_password(@password).should be_false
- end
- end
Add Comment
Please, Sign In to add comment