From 34dc1f9e105604e139d54d60102954db3acf9697 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 23 Feb 2015 17:14:54 -0500 Subject: [PATCH] Spec to ensure that SSO respects blocked emails --- spec/controllers/session_controller_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/controllers/session_controller_spec.rb b/spec/controllers/session_controller_spec.rb index a4389f4b9e3..2a64a9af12c 100644 --- a/spec/controllers/session_controller_spec.rb +++ b/spec/controllers/session_controller_spec.rb @@ -82,6 +82,20 @@ describe SessionController do expect(logged_on_user).to eq(nil) end + it 'respects email restrictions' do + sso = get_sso('/a/') + sso.external_id = '666' # the number of the beast + sso.email = 'bob@bob.com' + sso.name = 'Sam Saffron' + sso.username = 'sam' + + ScreenedEmail.block('bob@bob.com') + get :sso_login, Rack::Utils.parse_query(sso.payload) + + logged_on_user = Discourse.current_user_provider.new(request.env).current_user + expect(logged_on_user).to eq(nil) + end + it 'allows you to create an admin account' do sso = get_sso('/a/') sso.external_id = '666' # the number of the beast