Sha256: 23b5e924369d0c1b5f7e75f448dd3d5b5a26dd8ad0adfd736331b3e9fd70abe7
Contents?: true
Size: 1.65 KB
Versions: 51
Compression:
Stored size: 1.65 KB
Contents
require 'spec_helper' module Marty describe ApplicationController do before(:each) do subject.logout_user expect(Marty::User.current).to be_nil end describe 'authentication' do it 'should allow a registered user to log in' do allow(Rails.configuration.marty).to receive(:auth_source). and_return('local') user = Marty::User.try_to_login('marty', 'marty') subject.set_user(user) expect(Marty::User.current).to_not be_nil subject.logout_user expect(Marty::User.current).to be_nil end it 'should allow a registered user to log in when the database ' + 'is in recovery mode' do allow(Marty::Util).to receive(:db_in_recovery?).and_return(true) allow(Rails.configuration.marty).to receive(:auth_source). and_return('local') user = Marty::User.try_to_login('marty', 'marty') subject.set_user(user) expect(Marty::User.current).to_not be_nil subject.logout_user expect(Marty::User.current).to be_nil end it 'should prevent a non-registered user from logging in' do user = Marty::User.try_to_login('unknown_marty', 'invalid_password') expect(user).to be_nil expect(Marty::User.current).to be_nil end it 'should prevent a non-registered user from logging in when the ' + 'database is in recovery mode' do allow(Marty::Util).to receive(:db_in_recovery?).and_return(true) user = Marty::User.try_to_login('unknown_marty', 'invalid_password') expect(user).to be_nil expect(Marty::User.current).to be_nil end end end end
Version data entries
51 entries across 51 versions & 1 rubygems