Sha256: 5611141afc4b1ddc9d1d9ddb601b94b0aa671710c91cccbf56207695ef2d7620
Contents?: true
Size: 1.65 KB
Versions: 135
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
135 entries across 135 versions & 1 rubygems