diff options
author | Izaak Alpert <ialpert@blackberry.com> | 2013-09-17 16:37:36 -0400 |
---|---|---|
committer | Izaak Alpert <ialpert@blackberry.com> | 2013-09-17 22:38:08 -0400 |
commit | ca1b67ce38eb43edc969c0ca04264b7ea423413c (patch) | |
tree | ad5696dc23d8a600719f7a388518aca12d76adda /spec | |
parent | 16b6040c2e810253b29bfed4df5fcd098c456813 (diff) | |
download | gitlab-ce-ca1b67ce38eb43edc969c0ca04264b7ea423413c.tar.gz |
Don't show users password change page if ldap users
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb new file mode 100644 index 00000000000..d528d12c66c --- /dev/null +++ b/spec/controllers/application_controller_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe ApplicationController do + describe '#check_password_expiration' do + let(:user) { create(:user) } + let(:controller) { ApplicationController.new } + + it 'should redirect if the user is over their password expiry' do + user.password_expires_at = Time.new(2002) + user.ldap_user?.should be_false + controller.stub!(:current_user).and_return(user) + controller.should_receive(:redirect_to) + controller.should_receive(:new_profile_password_path) + controller.send(:check_password_expiration) + end + + it 'should not redirect if the user is under their password expiry' do + user.password_expires_at = Time.now + 20010101 + user.ldap_user?.should be_false + controller.stub!(:current_user).and_return(user) + controller.should_not_receive(:redirect_to) + controller.send(:check_password_expiration) + end + + it 'should not redirect if the user is over their password expiry but they are an ldap user' do + user.password_expires_at = Time.new(2002) + user.stub!(:ldap_user?).and_return(true) + controller.stub!(:current_user).and_return(user) + controller.should_not_receive(:redirect_to) + controller.send(:check_password_expiration) + end + end +end
\ No newline at end of file |