correct specs

This commit is contained in:
Sam Saffron 2015-06-05 18:58:20 +10:00 committed by Robin Ward
parent 2c883833eb
commit e5d2b49119

View File

@ -321,22 +321,9 @@ describe UsersController do
context 'enqueues mail' do context 'enqueues mail' do
it 'enqueues mail with admin email and sso enabled' do it 'enqueues mail with admin email and sso enabled' do
SiteSetting.enable_sso = true
Jobs.expects(:enqueue).with(:user_email, has_entries(type: :admin_login, user_id: admin.id)) Jobs.expects(:enqueue).with(:user_email, has_entries(type: :admin_login, user_id: admin.id))
put :admin_login, email: admin.email put :admin_login, email: admin.email
end end
it 'does not enqueue mail with admin email and sso disabled' do
SiteSetting.enable_sso = false
Jobs.expects(:enqueue).never
put :admin_login, email: admin.email
end
it 'does not enqueue mail with normal user email and sso enabled' do
SiteSetting.enable_sso = true
Jobs.expects(:enqueue).never
put :admin_login, email: user.email
end
end end
context 'logs in admin' do context 'logs in admin' do
@ -346,13 +333,13 @@ describe UsersController do
expect(session[:current_user_id]).to be_blank expect(session[:current_user_id]).to be_blank
end end
it 'does not log in admin with valid token and SSO disabled' do it 'does log in admin with valid token and SSO disabled' do
SiteSetting.enable_sso = false SiteSetting.enable_sso = false
token = admin.email_tokens.create(email: admin.email).token token = admin.email_tokens.create(email: admin.email).token
get :admin_login, token: token get :admin_login, token: token
expect(response).to redirect_to('/') expect(response).to redirect_to('/')
expect(session[:current_user_id]).to be_blank expect(session[:current_user_id]).to eq(admin.id)
end end
it 'logs in admin with valid token and SSO enabled' do it 'logs in admin with valid token and SSO enabled' do